public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top
Subject: [PATCH 13/18] tests: Remove unnecessary truncation of temporary files in udp tests
Date: Fri, 15 Jul 2022 15:21:36 +1000	[thread overview]
Message-ID: <20220715052141.890703-14-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20220715052141.890703-1-david@gibson.dropbear.id.au>

[-- Attachment #1: Type: text/plain, Size: 7893 bytes --]

All the UDP tests use :> to truncate some temporary data files.  This
appears to be so that they're empty before writing data to them with tee.
However tee, by default, truncates its output file anyway (you need tee -a
to append).  So drop the unnecessary truncations.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 test/udp/passt       |  2 --
 test/udp/passt_in_ns | 10 ----------
 test/udp/pasta       |  6 ------
 3 files changed, 18 deletions(-)

diff --git a/test/udp/passt b/test/udp/passt
index ee575e0..7c58648 100644
--- a/test/udp/passt
+++ b/test/udp/passt
@@ -26,7 +26,6 @@ gout	GUEST_MD5 md5sum test.bin | cut -d' ' -f1
 check	[ "__GUEST_MD5__" = "__HOST_MD5__" ]
 
 test	UDP/IPv4: guest to host
-host	:> __TEMP__
 hostb	(socat -u UDP4-LISTEN:10003,bind=127.0.0.1 STDOUT & echo $! > __SC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
 gout	GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
 guest	socat -u OPEN:test.bin UDP4:__GW__:10003
@@ -43,7 +42,6 @@ gout	GUEST_MD5 md5sum test.bin | cut -d' ' -f1
 check	[ "__GUEST_MD5__" = "__HOST_MD5__" ]
 
 test	UDP/IPv6: guest to host
-host	:> __TEMP__
 hostb	(socat -u UDP6-LISTEN:10003,bind=[::1] STDOUT & echo $! > __SC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
 gout	GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
 gout	IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
diff --git a/test/udp/passt_in_ns b/test/udp/passt_in_ns
index 3536298..8f8090b 100644
--- a/test/udp/passt_in_ns
+++ b/test/udp/passt_in_ns
@@ -28,7 +28,6 @@ check	[ "__GUEST_MD5__" = "__MD5__" ]
 
 test	UDP/IPv4: host to ns
 temp	TEMP_NS
-ns	:> __TEMP_NS__
 nsb	(socat -u UDP4-LISTEN:10002 STDOUT & echo $! > __SC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
 host	socat -u OPEN:__TEMP__ UDP4:127.0.0.1:10002
 nsw
@@ -36,7 +35,6 @@ nsout	NS_MD5 md5sum __TEMP_NS__ | cut -d' ' -f1
 check	[ "__NS_MD5__" = "__MD5__" ]
 
 test	UDP/IPv4: guest to host
-host	:> __TEMP__
 hostb	(socat -u UDP4-LISTEN:10003 STDOUT & echo $! > __SC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
 gout	GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
 guest	socat -u OPEN:test.bin UDP4:__GW__:10003
@@ -45,7 +43,6 @@ hout	HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
 check	[ "__HOST_MD5__" = "__MD5__" ]
 
 test	UDP/IPv4: guest to ns
-ns	:> __TEMP_NS__
 nsb	(socat -u UDP4-LISTEN:10002 STDOUT & echo $! > __SC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
 guest	socat -u OPEN:test.bin UDP4:__GW__:10002
 hostw
@@ -54,7 +51,6 @@ check	[ "__HOST_MD5__" = "__MD5__" ]
 
 test	UDP/IPv4: ns to host (recvmmsg/sendmmsg)
 sleep	1
-host	:> __TEMP__
 hostb	(socat -u UDP4-LISTEN:10003 STDOUT & echo $! > __SC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
 ns	socat -u OPEN:__TEMP_NS__ UDP4:127.0.0.1:10003
 hostw
@@ -62,7 +58,6 @@ hout	HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
 check	[ "__HOST_MD5__" = "__MD5__" ]
 
 test	UDP/IPv4: ns to host (via tap)
-host	:> __TEMP__
 hostb	(socat -u UDP4-LISTEN:10003 STDOUT & echo $! > __SC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
 ns	socat -u OPEN:__TEMP_NS__ UDP4:__GW__:10003
 hostw
@@ -93,7 +88,6 @@ gout	GUEST_MD5 md5sum test.bin | cut -d' ' -f1
 check	[ "__GUEST_MD5__" = "__MD5__" ]
 
 test	UDP/IPv6: host to ns
-ns	:> __TEMP_NS__
 nsb	(socat -u UDP6-LISTEN:10002 STDOUT & echo $! > __SC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
 host	socat -u OPEN:__TEMP__ UDP6:[::1]:10002
 nsw
@@ -101,7 +95,6 @@ nsout	NS_MD5 md5sum __TEMP_NS__ | cut -d' ' -f1
 check	[ "__NS_MD5__" = "__MD5__" ]
 
 test	UDP/IPv6: guest to host
-host	:> __TEMP__
 hostb	(socat -u UDP6-LISTEN:10003 STDOUT & echo $! > __SC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
 gout	GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
 gout	IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
@@ -111,7 +104,6 @@ hout	HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
 check	[ "__HOST_MD5__" = "__MD5__" ]
 
 test	UDP/IPv6: guest to ns
-ns	:> __TEMP_NS__
 nsb	(socat -u UDP6-LISTEN:10002 STDOUT & echo $! > __SC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
 guest	socat -u OPEN:test.bin UDP6:[__GW6__%__IFNAME__]:10002
 hostw
@@ -119,7 +111,6 @@ hout	HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
 check	[ "__HOST_MD5__" = "__MD5__" ]
 
 test	UDP/IPv6: ns to host (recvmmsg/sendmmsg)
-host	:> __TEMP__
 hostb	(socat -u UDP6-LISTEN:10003 STDOUT & echo $! > __SC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
 ns	socat -u OPEN:__TEMP_NS__ UDP6:[::1]:10003
 hostw
@@ -127,7 +118,6 @@ hout	HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
 check	[ "__HOST_MD5__" = "__MD5__" ]
 
 test	UDP/IPv6: ns to host (via tap)
-host	:> __TEMP__
 hostb	(socat -u UDP6-LISTEN:10003 STDOUT & echo $! > __SC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
 nsout	IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
 ns	socat -u OPEN:__TEMP_NS__ UDP6:[__GW6__%__IFNAME__]:10003
diff --git a/test/udp/pasta b/test/udp/pasta
index 43e0513..25063ea 100644
--- a/test/udp/pasta
+++ b/test/udp/pasta
@@ -18,7 +18,6 @@ test	UDP/IPv4: host to ns
 temp	TEMP
 temp	TEMP_NS
 temp	NC_PID
-ns	:> __TEMP_NS__
 nsb	(socat -u UDP4-LISTEN:10002,bind=127.0.0.1 STDOUT & echo $! > __NC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
 host	dd if=/dev/urandom bs=1k count=5 > __TEMP__ && printf "\nEND_OF_TEST\n" >> __TEMP__
 
@@ -29,7 +28,6 @@ nsout	NS_MD5 md5sum __TEMP_NS__ | cut -d' ' -f1
 check	[ "__NS_MD5__" = "__MD5__" ]
 
 test	UDP/IPv4: ns to host (recvmmsg/sendmmsg)
-host	:> __TEMP__
 hostb	(socat -u UDP4-LISTEN:10003,bind=127.0.0.1 STDOUT & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
 sleep	1
 ns	socat OPEN:__TEMP_NS__ UDP4:127.0.0.1:10003
@@ -38,7 +36,6 @@ hout	HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
 check	[ "__HOST_MD5__" = "__MD5__" ]
 
 test	UDP/IPv4: ns to host (via tap)
-host	:> __TEMP__
 hostb	(socat -u UDP4-LISTEN:10003 STDOUT & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
 nsout	GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
 ns	socat -u OPEN:__TEMP_NS__ UDP4:__GW__:10003
@@ -47,7 +44,6 @@ hout	HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
 check	[ "__HOST_MD5__" = "__MD5__" ]
 
 test	UDP/IPv6: host to ns
-ns	:> __TEMP_NS__
 nsb	(socat -u UDP6-LISTEN:10002,bind=[::1] STDOUT & echo $! > __NC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
 host	socat -u OPEN:__TEMP__ UDP6:[::1]:10002
 nsw
@@ -56,7 +52,6 @@ nsout	NS_MD5 md5sum __TEMP_NS__ | cut -d' ' -f1
 check	[ "__NS_MD5__" = "__MD5__" ]
 
 test	UDP/IPv6: ns to host (recvmmsg/sendmmsg)
-host	:> __TEMP__
 hostb	(socat -u UDP6-LISTEN:10003,bind=[::1] STDOUT & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
 sleep	1
 ns	socat -u OPEN:__TEMP_NS__ UDP6:[::1]:10003
@@ -66,7 +61,6 @@ check	[ "__HOST_MD5__" = "__MD5__" ]
 nsw
 
 test	UDP/IPv6: ns to host (via tap)
-host	:> __TEMP__
 hostb	(socat -u UDP6-LISTEN:10003 STDOUT & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
 nsout	GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
 nsout	IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
-- 
@@ -18,7 +18,6 @@ test	UDP/IPv4: host to ns
 temp	TEMP
 temp	TEMP_NS
 temp	NC_PID
-ns	:> __TEMP_NS__
 nsb	(socat -u UDP4-LISTEN:10002,bind=127.0.0.1 STDOUT & echo $! > __NC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
 host	dd if=/dev/urandom bs=1k count=5 > __TEMP__ && printf "\nEND_OF_TEST\n" >> __TEMP__
 
@@ -29,7 +28,6 @@ nsout	NS_MD5 md5sum __TEMP_NS__ | cut -d' ' -f1
 check	[ "__NS_MD5__" = "__MD5__" ]
 
 test	UDP/IPv4: ns to host (recvmmsg/sendmmsg)
-host	:> __TEMP__
 hostb	(socat -u UDP4-LISTEN:10003,bind=127.0.0.1 STDOUT & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
 sleep	1
 ns	socat OPEN:__TEMP_NS__ UDP4:127.0.0.1:10003
@@ -38,7 +36,6 @@ hout	HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
 check	[ "__HOST_MD5__" = "__MD5__" ]
 
 test	UDP/IPv4: ns to host (via tap)
-host	:> __TEMP__
 hostb	(socat -u UDP4-LISTEN:10003 STDOUT & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
 nsout	GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
 ns	socat -u OPEN:__TEMP_NS__ UDP4:__GW__:10003
@@ -47,7 +44,6 @@ hout	HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
 check	[ "__HOST_MD5__" = "__MD5__" ]
 
 test	UDP/IPv6: host to ns
-ns	:> __TEMP_NS__
 nsb	(socat -u UDP6-LISTEN:10002,bind=[::1] STDOUT & echo $! > __NC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
 host	socat -u OPEN:__TEMP__ UDP6:[::1]:10002
 nsw
@@ -56,7 +52,6 @@ nsout	NS_MD5 md5sum __TEMP_NS__ | cut -d' ' -f1
 check	[ "__NS_MD5__" = "__MD5__" ]
 
 test	UDP/IPv6: ns to host (recvmmsg/sendmmsg)
-host	:> __TEMP__
 hostb	(socat -u UDP6-LISTEN:10003,bind=[::1] STDOUT & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
 sleep	1
 ns	socat -u OPEN:__TEMP_NS__ UDP6:[::1]:10003
@@ -66,7 +61,6 @@ check	[ "__HOST_MD5__" = "__MD5__" ]
 nsw
 
 test	UDP/IPv6: ns to host (via tap)
-host	:> __TEMP__
 hostb	(socat -u UDP6-LISTEN:10003 STDOUT & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
 nsout	GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
 nsout	IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
-- 
2.36.1


  parent reply	other threads:[~2022-07-15  5:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-15  5:21 [PATCH 00/18] Test fixes, batch 5 David Gibson
2022-07-15  5:21 ` [PATCH 01/18] tests: Remove no longer needed /usr/bin/bash link David Gibson
2022-07-15  5:21 ` [PATCH 02/18] tests: Let Fedora find dhclient-script in /usr/sbin David Gibson
2022-07-15  5:21 ` [PATCH 03/18] tests: Add rudimentary debugging to dhclient-script David Gibson
2022-07-15  5:21 ` [PATCH 04/18] tests: Add some extra dhclient support directories to mbuto.img David Gibson
2022-07-15  5:21 ` [PATCH 05/18] tests: More robust parsing of resolv.conf for DHCP tests David Gibson
2022-07-15  5:21 ` [PATCH 06/18] tests: Handle the case of a nameserver on host localhost David Gibson
2022-07-15  5:21 ` [PATCH 07/18] tests: Correctly handle domain search list in dhclient-script David Gibson
2022-07-15  5:21 ` [PATCH 08/18] tests: Fix detection of empty 'hout' responses in passt{,_in_ns} tests David Gibson
2022-07-15  5:21 ` [PATCH 09/18] tests: Fix creation of test file in udp passt tests David Gibson
2022-07-15  5:21 ` [PATCH 10/18] valgrind needs futex David Gibson
2022-07-15  5:21 ` [PATCH 11/18] tests: Use socat instead of netcat David Gibson
2022-07-15  5:21 ` [PATCH 12/18] tests: Remove unnecessary ^D in passt_in_ns teardown David Gibson
2022-07-15  5:21 ` David Gibson [this message]
2022-07-15  5:21 ` [PATCH 14/18] tests: Use dhclient --no-pid for namespaces in two_guests tests David Gibson
2022-07-15  5:21 ` [PATCH 15/18] tests: Clean up better after iperf tests David Gibson
2022-07-15  5:21 ` [PATCH 16/18] tests: No need to retrieve host ifname in ndp/pasta David Gibson
2022-07-15  5:21 ` [PATCH 17/18] tests: Correct determination of host interface name in tests David Gibson
2022-07-19  6:20   ` David Gibson
2022-07-19 19:05     ` Stefano Brivio
2022-07-20  2:47       ` David Gibson
2022-07-20  7:24         ` David Gibson
2022-07-20  8:23           ` Stefano Brivio
2022-07-20 10:33             ` David Gibson
2022-07-15  5:21 ` [PATCH 18/18] demo: Use git protocol downloads David Gibson
2022-07-21 12:13 ` [PATCH 00/18] Test fixes, batch 5 Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220715052141.890703-14-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).