Skip to content

Test Suite broken due to using /bin/sh with [[ operator #2144

@davidfavor

Description

@davidfavor

Several scripts in the test suite contain #!/bin/sh in first line.

Then in the script use "[[...]]" which is a bash-ism.

These scripts fail with all sorts of bogus errors related to this problem.

Here's an example...

# make check
make -C tests shortest
make[1]: Entering directory '/root/zstd.git/tests'
make -C ../programs zstd MOREFLAGS+="-g -DDEBUGLEVEL=1"
make[2]: Entering directory '/root/zstd.git/programs'
make[2]: 'zstd' is up to date.
make[2]: Leaving directory '/root/zstd.git/programs'
file ../programs/zstd
../programs/zstd: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=1c33f5eea4fcd0bd81be4a18a7c42952b5a848a4, for GNU/Linux 3.2.0, not stripped
EXE_PREFIX="" ZSTD_BIN="../programs/zstd" DATAGEN_BIN=./datagen ./playTests.sh 

Starting playTests.sh isWindows=false EXE_PREFIX='' ZSTD_BIN='../programs/zstd'

===>  simple tests 

test : basic compression 
tmp                  : 32.50%   ( 65537 =>  21298 bytes, tmp.zst)              
test : basic decompression
tmp.zst             : 65537 bytes                                              
test : too large compression level => auto-fix
Warning : compression level higher than max, reduced to 19 
tmp                  : 31.54%   ( 65537 =>  20669 bytes, tmp.zst)              
error: numeric value overflows 32-bit unsigned int 
test : --fast aka negative compression levels
tmp                  : 55.93%   ( 65537 =>  36656 bytes, tmp.zst)              
tmp                  : 56.31%   ( 65537 =>  36902 bytes, tmp.zst)              
tmp                  :100.02%   ( 65537 =>  65551 bytes, tmp.zst)              
error: numeric value overflows 32-bit unsigned int 
Incorrect parameters 
Usage : 
      zstd [args] [FILE(s)] [-o file] 

FILE    : a filename 
          with no FILE, or when FILE is - , read standard input
Arguments : 
 -#     : # compression level (1-19, default: 3) 
 -d     : decompression 
 -D DICT: use DICT as Dictionary for compression or decompression 
 -o file: result stored into `file` (only 1 output file) 
 -f     : overwrite output without prompting, also (de)compress links 
--rm    : remove source file(s) after successful de/compression 
 -k     : preserve source file(s) (default) 
 -h/-H  : display help/long help and exit 
test : too large numeric argument
error: numeric value overflows 32-bit unsigned int 
test : set compression level with environment variable ZSTD_CLEVEL
tmp                  : 32.50%   ( 65537 =>  21298 bytes, tmp.zst)              
tmp                  : 32.50%   ( 65537 =>  21298 bytes, tmp.zst)              
tmp                  : 32.50%   ( 65537 =>  21298 bytes, tmp.zst)              
tmp                  : 32.50%   ( 65537 =>  21298 bytes, tmp.zst)              
tmp                  : 32.50%   ( 65537 =>  21298 bytes, tmp.zst)              
tmp                  : 32.50%   ( 65537 =>  21298 bytes, tmp.zst)              
tmp                  : 32.50%   ( 65537 =>  21298 bytes, tmp.zst)              
tmp                  : 32.50%   ( 65537 =>  21298 bytes, tmp.zst)              
tmp                  : 32.50%   ( 65537 =>  21298 bytes, tmp.zst)              
test : override ZSTD_CLEVEL with command line option
tmp                  : 56.31%   ( 65537 =>  36902 bytes, tmp.zst)              
test : compress to stdout
tmp                  : 32.50%   ( 65537 =>  21298 bytes, /*stdout*\)           
test : compress to named file
tmp                  : 32.50%   ( 65537 =>  21298 bytes, tmpCompressed)        
test : -o must be followed by filename (must fail)
error : command must be followed by argument 
test : force write, correct order
tmp                  : 32.50%   ( 65537 =>  21298 bytes, tmpCompressed)        
test : forgotten argument
error : command must be followed by argument 
test : implied stdout when input is stdin
bob
test : compressed data to terminal
Incorrect parameters 
Usage : 
      zstd [args] [FILE(s)] [-o file] 

FILE    : a filename 
          with no FILE, or when FILE is - , read standard input
Arguments : 
 -#     : # compression level (1-19, default: 3) 
 -d     : decompression 
 -D DICT: use DICT as Dictionary for compression or decompression 
 -o file: result stored into `file` (only 1 output file) 
 -f     : overwrite output without prompting, also (de)compress links 
--rm    : remove source file(s) after successful de/compression 
 -k     : preserve source file(s) (default) 
 -h/-H  : display help/long help and exit 
test : compressed data from terminal (a hang here is a test fail, zstd is wrongly waiting on data from terminal)
Incorrect parameters 
Usage : 
      zstd [args] [FILE(s)] [-o file] 

FILE    : a filename 
          with no FILE, or when FILE is - , read standard input
Arguments : 
 -#     : # compression level (1-19, default: 3) 
 -d     : decompression 
 -D DICT: use DICT as Dictionary for compression or decompression 
 -o file: result stored into `file` (only 1 output file) 
 -f     : overwrite output without prompting, also (de)compress links 
--rm    : remove source file(s) after successful de/compression 
 -k     : preserve source file(s) (default) 
 -h/-H  : display help/long help and exit 
test : null-length file roundtrip
-n 
test : ensure small file doesn't add 3-bytes null block

tmp1                 :1400.00%   (     1 =>     14 bytes, /*stdout*\)          
14
14
test : decompress file with wrong suffix (must fail)
zstd: tmpCompressed: unknown suffix (.zst/.tzst/.gz/.tgz/.lzma/.xz/.txz/.lz4/.tlz4 expected). Can't derive the output file name. Specify it with -o dstFileName. Ignoring.
zstd: tmp: unknown suffix (.zst/.tzst/.gz/.tgz/.lzma/.xz/.txz/.lz4/.tlz4 expected). Can't derive the output file name. Specify it with -o dstFileName. Ignoring.
test : decompress into stdout
tmpCompressed       : 65537 bytes                                              
tmpCompressed       : 65537 bytes                                              
test : decompress from stdin into stdout
test : impose memory limitation (must fail)
tmp.zst : Decoding error (36) : Frame requires too much memory for decoding 
tmp.zst : Window size larger than maximum : 65537 > 2048 
tmp.zst : Use --long=17 or --memory=1MB 
tmp.zst : Decoding error (36) : Frame requires too much memory for decoding 
tmp.zst : Window size larger than maximum : 65537 > 2048 
tmp.zst : Use --long=17 or --memory=1MB 
tmp.zst : Decoding error (36) : Frame requires too much memory for decoding 
tmp.zst : Window size larger than maximum : 65537 > 2048 
tmp.zst : Use --long=17 or --memory=1MB 
tmp.zst : Decoding error (36) : Frame requires too much memory for decoding 
tmp.zst : Window size larger than maximum : 65537 > 2048 
tmp.zst : Use --long=17 or --memory=1MB 
test : overwrite protection
zstd: tmp.zst already exists; not overwritten  
test : force overwrite
test : overwrite readonly file
zstd: tmpro.zst already exists; not overwritten  
test: --no-progress flag
tmpro                :425.00%   (     4 =>     17 bytes, /*stdout*\)           
/*stdin*\           : 4 bytes                                                  
*** zstd command line interface 64-bits v1.4.5, by Yann Collet ***
*** zstd command line interface 64-bits v1.4.5, by Yann Collet ***
tmpro                :425.00%   (     4 =>     17 bytes, /*stdout*\)           
/*stdin*\           : 4 bytes                                                  
test: overwrite input file (must fail)
zstd: Refusing to open an output file which will overwrite the input file 
zstd: Refusing to open an output file which will overwrite the input file 
test: detect that input file does not exist
zstd: can't stat nothere : No such file or directory -- ignored 
test: --[no-]compress-literals
/*stdin*\            : 0 MB...     tmp                  : 54.22%   ( 65537 =>  35532 bytes, /*stdout*\) 
/*stdin*\           : 65537 bytes                                              
tmp                  : 55.93%   ( 65537 =>  36656 bytes, /*stdout*\)           
/*stdin*\           : 65537 bytes                                              
tmp                  : 39.32%   ( 65537 =>  25772 bytes, /*stdout*\)           
/*stdin*\           : 65537 bytes                                              
tmp                  : 32.75%   ( 65537 =>  21461 bytes, /*stdout*\)           
/*stdin*\           : 65537 bytes                                              
/*stdin*\            : 0 MB...     tmp                  : 33.85%   ( 65537 =>  22183 bytes, /*stdout*\) 
/*stdin*\           : 65537 bytes                                              
tmp                  : 31.54%   ( 65537 =>  20669 bytes, /*stdout*\)           
/*stdin*\           : 65537 bytes                                              
-1#tmp               :     65537 ->     22179 (2.955), 223.4 MB/s ,1214.2 MB/s 
 0#tmp               :     65537 ->     21294 (3.078), 113.3 MB/s ,1213.4 MB/s 
 1#tmp               :     65537 ->     21457 (3.054), 215.6 MB/s ,1299.3 MB/s 
-1#tmp               :     65537 ->     36652 (1.788), 297.7 MB/s ,4232.0 MB/s 
 0#tmp               :     65537 ->     34517 (1.899), 101.6 MB/s ,3499.5 MB/s 
 1#tmp               :     65537 ->     35528 (1.845), 272.3 MB/s ,4548.7 MB/s 

===> zstdgrep tests
tmp_grep             :360.00%   (     5 =>     18 bytes, tmp_grep.zst)         
zstd: can't stat tmp_grep_bad.zst : No such file or directory -- ignored 
zstd: can't stat tmp_grep_bad.zst : No such file or directory -- ignored 

===>  --exclude-compressed flag




./playTests.sh: 270: [[: not found
Test is not successful

Test completed

===>  recursive mode test 

===>  file removal
tmp                  : 32.50%   ( 65537 =>  21298 bytes, tmp.zst)              
tmp.zst             : 65537 bytes                                              
test : should quietly not remove non-regular file
make[1]: *** [Makefile:327: test-zstd] Error 1
make[1]: Leaving directory '/root/zstd.git/tests'
make: *** [Makefile:87: shortest] Error 2

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions