From nobody Mon Mar 13 16:16:41 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pb1xj2cQbz3xtkg; Mon, 13 Mar 2023 16:16:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pb1xj28JQz4DPc; Mon, 13 Mar 2023 16:16:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678724201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dkf6LGvXyPQoOgvMpIPtmMvzlIUAW6nRvdjqiBQzSJY=; b=Mf3+Z3JIwNyMgIyhL1frnuLKKL5j7N3Z1gDwHKv8Ai9ZMUCye9JyqD+eceR5WrAeGFSXIo itGZeltUKq0rMiqCBbArrJGYNHRyPfAE4Lp/NEG7YB1KD8NftsHofL9+OFX2LlgeF5RDeQ WEOgbVUmzmGEXfbLYV1vJU4SNFJz0BcOUN6I+fjcoCJjeciuEMaV/8/viXc2ROrBlVpX32 7fNh3QSH4mTqo/kGzrTThj3SCJlktF1JRxkYRSOPCLFXxPaavnesMZlz++sUVgvZEJO+9a G6QZwLeBualuuF1GOxnZswvGB4sa+qWeFz/zKmmHiJJnmVm7dc+ncGcIHBJKoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678724201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dkf6LGvXyPQoOgvMpIPtmMvzlIUAW6nRvdjqiBQzSJY=; b=l8ggn/wv2HixS8Yq9PU+gsTrMAe2PNqAtgYxoH8g7b0/bkuEFhIqP9LchPLSNfmMGL/97O gJ+LznvJNX0jk4GKqkEJ8j32jSS+2qLYhu8nEySI8Hk4S1A6cFwMOtMEt//hIzbchMNFNG fuZ/Q6e/Rl8yWz3o4pn4EnLL1FHCpcUV1/o/2L61stifwYx2wzWKDBln78kiBZwrwHxmNY xl95BVCYTRHWmST556rQCfZrar+X9pAlFb7BH7tlOJpoN/Ix6ddfaOWdsCSqQR5IDguvH4 9r4FT++qwHaG1MYwEfsyCoWWggqqJTSSMDeCfkLUsDyOBaAbZQi2C2kFT0eLmg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678724201; a=rsa-sha256; cv=none; b=Yjp5MQ74nQ0GRANDbqLBE37SfVn+wJq2zP+T2C7D4JoIo44oKJF3MgFPzJTDMxk+x915Cr /kvzsSJVAQUcUKzdf9+XhSGZiomFBCDb2eOAq42rWB1jYWUPnQGeSiDNGpMKSUNHng+zLb 21kWSP/lgyQOOhriJtOwOeO/Jz8YBDj/WkESkpGeVVLxIXg62Is7WnFZMzAE6OWyRMQVDA 6fbGEEVkQFMOxcchigpOzVLS4IKSR95WKoLEaIbnNp/C4apy1RCsDWBGIBowLTbgxyvcwP hg1ZJmc3XPZ1hY7UXoPAS+MyOOFdGVNXbU1HpNorjIMl6HvIhWV88nAFQc4k2Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pb1xj0v62z10Hh; Mon, 13 Mar 2023 16:16:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32DGGfEj074359; Mon, 13 Mar 2023 16:16:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32DGGfLf074358; Mon, 13 Mar 2023 16:16:41 GMT (envelope-from git) Date: Mon, 13 Mar 2023 16:16:41 GMT Message-Id: <202303131616.32DGGfLf074358@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: fc76ddee9be0 - main - tftp: Add test cases for URL mode. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fc76ddee9be0d7f98c9f9a162627950f8102964e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=fc76ddee9be0d7f98c9f9a162627950f8102964e commit fc76ddee9be0d7f98c9f9a162627950f8102964e Author: Dag-Erling Smørgrav AuthorDate: 2023-03-13 16:16:10 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-03-13 16:16:26 +0000 tftp: Add test cases for URL mode. Sponsored by: Klara, Inc. Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D39014 --- usr.bin/tftp/tests/tftp_test.sh | 59 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/usr.bin/tftp/tests/tftp_test.sh b/usr.bin/tftp/tests/tftp_test.sh index 96e375f51aeb..a4c9f3b898e7 100644 --- a/usr.bin/tftp/tests/tftp_test.sh +++ b/usr.bin/tftp/tests/tftp_test.sh @@ -386,6 +386,62 @@ tftp_put_multi_host_cleanup() { stop_tftpd } +atf_test_case tftp_url_host cleanup +tftp_url_host_head() { + atf_set "descr" "URL with hostname" + atf_set "require.user" "root" +} +tftp_url_host_body() { + start_tftpd + local remote_file="${tftp_dir}/hello.txt" + echo "Hello, $$!" >"${remote_file}" + local local_file="${remote_file##*/}" + atf_check -o match:"Received [0-9]+ bytes" \ + tftp tftp://localhost/"${remote_file##*/}" + atf_check cmp -s "${local_file}" "${remote_file}" +} +tftp_url_host_cleanup() { + stop_tftpd +} + +atf_test_case tftp_url_ipv4 cleanup +tftp_url_ipv4_head() { + atf_set "descr" "URL with IPv4 address" + atf_set "require.user" "root" +} +tftp_url_ipv4_body() { + start_tftpd + local remote_file="${tftp_dir}/hello.txt" + echo "Hello, $$!" >"${remote_file}" + local local_file="${remote_file##*/}" + atf_check -o match:"Received [0-9]+ bytes" \ + tftp tftp://127.0.0.1/"${remote_file##*/}" + atf_check cmp -s "${local_file}" "${remote_file}" +} +tftp_url_ipv4_cleanup() { + stop_tftpd +} + +atf_test_case tftp_url_ipv6 cleanup +tftp_url_ipv6_head() { + atf_set "descr" "URL with IPv6 address" + atf_set "require.user" "root" +} +tftp_url_ipv6_body() { + sysctl -q kern.features.inet6 || atf_skip "This test requires IPv6 support" + atf_expect_fail "tftp does not support bracketed IPv6 literals in URLs" + start_tftpd + local remote_file="${tftp_dir}/hello.txt" + echo "Hello, $$!" >"${remote_file}" + local local_file="${remote_file##*/}" + atf_check -o match:"Received [0-9]+ bytes" \ + tftp tftp://"[::1]"/"${remote_file##*/}" + atf_check cmp -s "${local_file}" "${remote_file}" +} +tftp_url_ipv6_cleanup() { + stop_tftpd +} + atf_init_test_cases() { atf_add_test_case tftp_get_big atf_add_test_case tftp_get_host @@ -403,4 +459,7 @@ atf_init_test_cases() { atf_add_test_case tftp_put_two atf_add_test_case tftp_put_more atf_add_test_case tftp_put_multi_host + atf_add_test_case tftp_url_host + atf_add_test_case tftp_url_ipv4 + atf_add_test_case tftp_url_ipv6 }