On 01/24/2014 07:05 PM, Assaf Gordon wrote: > Hello, > > Attached is a small script I've been using. > It helps running multiple tests for a given program. > > example: > ./scripts/check_program sort > > Will find all sort-related tests (based on filename) and run them. > Adding "-e" or "-v" also runs expensive and very expensive tests: > > examle: > ./scripts/check_program -v sort > > is equivalent to: > make check VERBOSE=yes SUBDIRS=. \ > RUN_EXPENSIVE_TESTS=yes \ RUN_VERY_EXPENSIVE_TESTS=yes \ > TESTS="./tests/misc/sort-NaN-infloop.sh > ./tests/misc/sort-benchmark-random.sh > ./tests/misc/sort-compress-hang.sh > ./tests/misc/sort-compress-proc.sh > ./tests/misc/sort-compress.sh > ./tests/misc/sort-continue.sh > ./tests/misc/sort-debug-keys.sh > ./tests/misc/sort-debug-warn.sh > ./tests/misc/sort-discrim.sh > ./tests/misc/sort-exit-early.sh > ./tests/misc/sort-files0-from.pl > ./tests/misc/sort-float.sh > ./tests/misc/sort-merge-fdlimit.sh > ./tests/misc/sort-merge.pl > ./tests/misc/sort-month.sh > ./tests/misc/sort-rand.sh > ./tests/misc/sort-spinlock-abuse.sh > ./tests/misc/sort-stale-thread-mem.sh > ./tests/misc/sort-u-FMR.sh > ./tests/misc/sort-unique-segv.sh > ./tests/misc/sort-unique.sh > ./tests/misc/sort-version.sh > ./tests/misc/sort.pl" > > > If others find it useful, you're welcomed to add this.
This is a good idea. I have something similar (attached) where I can pass a test or a test directory or program. The most common use I have for that is: ./make --test tests/misc/test-name.sh Since there are multiple --test modes, I suppose we could merge both our scripts to a ./check script? The other modes in my `make` script would probably be best as make targets. thanks, Pádraig.
#!/bin/sh # Support ./make --test tests/misc/md5sum-bsd if [ "$1" = '--test' ]; then shift if test -d "$1"; then tests="$(shopt -s nullglob; echo tests/dd/*.{sh,pl})" elif ! printf '%s\n' "$1" | grep -qF . "$1"; then # Mo .suffix then look for program name tests=$(find tests/ -name "*.sh" -o -name "*.pl" | xargs grep -l "print_ver_.*$1" | paste -s -d' ') else tests="$*" fi # SUBDIRS avoids gnulib tests make check TESTS="$tests" SUBDIRS=. VERBOSE=yes RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes exit elif [ "$1" = '--test-gl' ]; then shift gnulib/gnulib-tool --local-dir=gl --create-testdir --with-tests --test "$@" elif [ "$1" = '--32' ]; then shift # Run once without params to reset everything # subsequent runs must both specify --32 _and_ a target if [ $# = 0 ]; then make clean CFLAGS=-m32 ./configure --quiet --with-openssl=optional fi bitwidth=-m32 elif [ "$1" = '--64' ]; then shift make clean ./configure --quiet --with-openssl=optional fi cores=$(($(nproc) * 2)) # Work around syntax-check parallel make issues # Fixed since Sep 6 2012 with non recursive make change: # Avoid automake update for https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2012-3386 #[ "$1" = 'syntax-check' ] && sed -i 's/chmod a+w \$(distdir)/chmod u+w \$(distdir)/' Makefile Makefile.in # -Wno-error=suggest-attribute=pure needed for gcc <= 4.6.0 _CFLAGS="$bitwidth -march=native -g -O2 -Wno-error=suggest-attribute=pure" if [ "$1" = '--debug' ]; then _CFLAGS="-ggdb" # Disable -Werror completely for debug as # -Wuninitialized needs -O for example WERROR='WERROR_CFLAGS=' shift fi make -j$cores CFLAGS="$_CFLAGS" $WERROR "$@" # I'm not sure why these are split out # Maybe coreutils specific syntax checks? [ "$1" = "syntax-check" ] && make check-local