Skip to contentSkip to conversation

macsec: fix double delete the tmp file

PATCH New Sun Lianwen 2 participants 3 messages Jun 9, 2018 – Jun 10, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 macsec: fix double delete the tmp file

The virt_cleanup and tst_ipsec_cleanup in both in the cleanup() which will double delete the tmp file. and result to report below info:
"rm: cannot remove ‘/tmp/ltp-ddLUcf8ACl/macsec01.6YQ9qGRNuC’: No such file or directory"

---
 testcases/network/virt/macsec01.sh | 10 +++++++++-
 testcases/network/virt/macsec02.sh | 12 ++++++++++--
 2 files changed, 19 insertions(+), 3 deletions(-)
testcases/network/virt/macsec01.sh +9 -1
index 52d6f071a..1a3499648 100755
@@ -31,7 +31,15 @@ VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-100}
 cleanup()
 {
 	virt_cleanup
-	tst_ipsec_cleanup
+
+	ip xfrm state flush
+	ip xfrm policy flush
+	tst_rhost_run -c "ip xfrm state flush && ip xfrm policy flush"
+
+	if [ -n "$cleanup_vti" ]; then
+		ip li del $cleanup_vti 2>/dev/null
+		tst_rhost_run -c "ip li del $cleanup_vti 2>/dev/null"
+	fi
 }
 TST_CLEANUP="cleanup"
 
testcases/network/virt/macsec02.sh +10 -2
index 617860d41..6276a6b09 100755
@@ -30,8 +30,16 @@ VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-100}
 
 cleanup()
 {
-	virt_cleanup
-	tst_ipsec_cleanup
+    virt_cleanup
+
+    ip xfrm state flush
+    ip xfrm policy flush
+    tst_rhost_run -c "ip xfrm state flush && ip xfrm policy flush"
+
+    if [ -n "$cleanup_vti" ]; then
+        ip li del $cleanup_vti 2>/dev/null
+        tst_rhost_run -c "ip li del $cleanup_vti 2>/dev/null"
+    fi
 }
 TST_CLEANUP="cleanup"
 
Signature · 1 line
2.17.0
#1 lore raw

PATCH 1/1 macsec: fix double delete the tmp file

Hi Sun,

Quoted 4 lines

The virt_cleanup and tst_ipsec_cleanup in both in the cleanup() which will double delete the tmp file. and result to report below info:
"rm: cannot remove ‘/tmp/ltp-ddLUcf8ACl/macsec01.6YQ9qGRNuC’: No such file or directory"

Thanks for your patch. I've noticed that, but didn't try to fix that as macsec tests run under new API doesn't complain, because tst_test.sh (unlike test.sh) actually check whether directory exist. (Next week hopefully I'm going to send patch which rewrites tests which uses ipsec_lib.sh and virt_lib.sh).

Your test introduces duplicity with tst_ipsec_cleanup, it's here 3 times
+ code in macsec02.sh uses spaces instead of tabs.

As the issue isn't specific and it's going to be fixed just by migrating to new API, I'd propose not to accept it. Alexey, what do you think?

Kind regards,
Petr

#2 lore raw

PATCH 1/1 macsec: fix double delete the tmp file

Hi Petr

Quoted 11 lines · Petr Vorel

Hi Sun,

Quoted 4 lines

The virt_cleanup and tst_ipsec_cleanup in both in the cleanup() which will double delete the tmp file. and result to report below info:
"rm: cannot remove ‘/tmp/ltp-ddLUcf8ACl/macsec01.6YQ9qGRNuC’: No such file or directory"

Thanks for your patch. I've noticed that, but didn't try to fix that as macsec tests run under new API doesn't complain, because tst_test.sh (unlike test.sh) actually check whether directory exist. (Next week hopefully I'm going to send patch which rewrites tests which uses ipsec_lib.sh and virt_lib.sh).

Quoted 6 lines

Your test introduces duplicity with tst_ipsec_cleanup, it's here 3 times
+ code in macsec02.sh uses spaces instead of tabs.

As the issue isn't specific and it's going to be fixed just by migrating to new API, I'd propose not to accept it. Alexey, what do you think?

Thanks your answer, I think you are right. It is nice if the new API can fix this.

Quoted 7 lines

Kind regards,
Petr

.