"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Regress: accommodate other ls implementations
To:
gameoftrees@openbsd.org
Date:
Sat, 3 Oct 2020 14:08:18 +0200

Download raw body.

Thread
accommodate ls -l implementations that print "total 0" in an empty directory

Both FreeBSD and GNU ls(1) behave that way.

The test uses "ls -l" to show that there are no leftover files and
compares the output to an empty file.  We could use something like
"echo *" instead, but I guess the idea is to see at a glance what's
up in case of failure.

diff 016859fc51b660d7fc95ca5eff449d62c67f8a7f /home/naddy/got
blob - 149f0bdc3cc44d53a90d7d467740210e86263f89
file + regress/cmdline/rm.sh
--- regress/cmdline/rm.sh
+++ regress/cmdline/rm.sh
@@ -239,7 +239,7 @@ test_rm_directory() {
 		return 1
 	fi
 
-	(cd $testroot/wt && ls -l > $testroot/stdout)
+	(cd $testroot/wt && ls -l | sed '/^total/d' > $testroot/stdout)
 
 	echo -n '' > $testroot/stdout.expected
 
@@ -251,7 +251,7 @@ test_rm_directory() {
 		return 1
 	fi
 
-	(cd $testroot/wt && ls -l > $testroot/stdout)
+	(cd $testroot/wt && ls -l | sed '/^total/d' > $testroot/stdout)
 
 	echo -n '' > $testroot/stdout.expected
 
-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de