Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] tests: fix some failures with alpine/busybox/musl



  Test ./A01grammar.ztst failed: bad status 127, expected 0 from:
    (exec -a /bin/SPLATTER /bin/sh -c 'echo $0')
  Error output:
  SPLATTER: applet not found
  Was testing: `exec' with -a option
  ./A01grammar.ztst: test failed.

fails when /bin/sh is busybox, because it doesn't like when you give it
an argv[0] that isn't the name of one of its 'applets'. fixed by using
the zsh under test

  --- /tmp/zsh.ztst.22574/ztst.out
  +++ /tmp/zsh.ztst.22574/ztst.tout
  @@ -1,4 +1,5 @@
  -1c1
  -< First	Second	Third	Fourth
  ----
  -> Erste	Zweite	Dritte	Vierte
  +--- /tmp/zshDNjCCi
  ++++ /tmp/zshEooJCi
  +@@ -1 +1 @@
  +-First	Second	Third	Fourth
  ++Erste	Zweite	Dritte	Vierte
  Test ./D03procsubst.ztst failed: output differs from expected as shown above for:
    diff =(cat FILE1) =(cat FILE2)
  Was testing: =(...) substitution
  ./D03procsubst.ztst: test failed.

fails when diff is busybox because it only supports unified output. i
don't think the use of diff here is critical, fixed by making it use
paste like the <(...) test

  Test ./V09datetime.ztst failed: bad status 1, expected 0 from:
    [[ $(strftime '%@' 0 2> /dev/null) == (%|)@ || $? != 0 ]]
  Was testing: bad format specifier
  ./V09datetime.ztst: test failed.

fails because musl's strftime() bails when it sees an unrecognised
sequence, and ztrftime() doesn't detect it as an error. fixed by
checking for empty string. (i think this is just a regression test to
make sure it doesn't blow up so the exact output probably isn't that
important)

there are several tests that will still fail on musl systems due to its
weird C locale (see w/50235). i haven't found any way to make those
work. we could add conditions to gracefully skip them but it feels
annoying for an unusual and arguably broken locale

dana


diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index a65dc57f1..eea6ede2b 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -128,11 +128,11 @@
 0:`exec' with -l option
 >-zsh
 
-  (exec -a /bin/SPLATTER /bin/sh -c 'echo $0')
+  (exec -a /bin/SPLATTER $ZTST_testdir/../Src/zsh -fc 'echo $0')
 0:`exec' with -a option
 >/bin/SPLATTER
 
-  (exec -a/bin/SPLOOSH /bin/sh -c 'echo $0')
+  (exec -a/bin/SPLOOSH $ZTST_testdir/../Src/zsh -fc 'echo $0')
 0:`exec' with -a option, no space
 >/bin/SPLOOSH
 
@@ -144,7 +144,7 @@
 
   (
     opts=(-a /bin/WHOOOSH)
-    exec $opts /bin/sh -c 'echo $0'
+    exec $opts $ZTST_testdir/../Src/zsh -fc 'echo $0'
   )
 0:`exec' with -a option from expansion
 >/bin/WHOOOSH
diff --git a/Test/D03procsubst.ztst b/Test/D03procsubst.ztst
index d68db35fa..d7f57afdc 100644
--- a/Test/D03procsubst.ztst
+++ b/Test/D03procsubst.ztst
@@ -25,12 +25,9 @@
 0:>(...) substitution
 >SEcond	ViErtE
 
-  diff =(cat FILE1) =(cat FILE2)
-1:=(...) substitution
->1c1
->< First	Second	Third	Fourth
->---
->> Erste	Zweite	Dritte	Vierte
+  paste =(cut -f1 FILE1) =(cut -f3 FILE2)
+0:=(...) substitution
+>First	Dritte
 
   copycat <(print First) <(print Zweite)
 0:FDs remain open for external commands called from functions
diff --git a/Test/V09datetime.ztst b/Test/V09datetime.ztst
index 0eae31687..cbf6967b0 100644
--- a/Test/V09datetime.ztst
+++ b/Test/V09datetime.ztst
@@ -79,8 +79,8 @@
 >1973^@03^@03
 
 # We assume '%@' is not a valid format on any OSs.
-# The result can be '%@' (Linux), '@' (BSDs) or an error (Cygwin).
-  [[ $(strftime '%@' 0 2> /dev/null) == (%|)@ || $? != 0 ]]
+# The result can be '%@' (Linux), '@' (BSDs), '' (musl), or an error (Cygwin).
+  [[ $(strftime '%@' 0 2> /dev/null) == ((%|)@|) || $? != 0 ]]
 0:bad format specifier
 
 # This test may fail at 23:59:59.xxx on New Year's Eve :/




Messages sorted by: Reverse Date, Date, Thread, Author