diff options
Diffstat (limited to '')
-rwxr-xr-x | src/isa-l/tools/check_format.sh | 87 | ||||
-rwxr-xr-x | src/isa-l/tools/iindent | 2 | ||||
-rwxr-xr-x | src/isa-l/tools/nasm-filter.sh | 47 | ||||
-rwxr-xr-x | src/isa-l/tools/remove_trailing_whitespace.sh | 2 | ||||
-rwxr-xr-x | src/isa-l/tools/test_autorun.sh | 63 | ||||
-rwxr-xr-x | src/isa-l/tools/test_checks.sh | 115 | ||||
-rwxr-xr-x | src/isa-l/tools/test_extended.sh | 208 | ||||
-rwxr-xr-x | src/isa-l/tools/test_fuzz.sh | 171 | ||||
-rwxr-xr-x | src/isa-l/tools/test_tools.sh | 11 | ||||
-rwxr-xr-x | src/isa-l/tools/yasm-filter.sh | 38 |
10 files changed, 744 insertions, 0 deletions
diff --git a/src/isa-l/tools/check_format.sh b/src/isa-l/tools/check_format.sh new file mode 100755 index 000000000..dfc92b150 --- /dev/null +++ b/src/isa-l/tools/check_format.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash + +set -e +rc=0 +verbose=0 +indent_args='-linux -l95 -cp1 -lps -il6 -ncs' +function iver { printf "%03d%03d%03d%03d" $(echo "$@" | sed 's/GNU indent//' | tr '.' ' '); } + +while [ -n "$*" ]; do + case "$1" in + -v ) + verbose=1 + shift + ;; + -h ) + echo check_format.sh [-h -v] + exit 0 + ;; + esac +done + +echo "Checking format of files in the git index at $PWD" +if ! git rev-parse --is-inside-work-tree >& /dev/null; then + echo "Not in a git repo: Fail" + exit 1 +fi + +if hash indent && [ $(iver $(indent --version)) -ge $(iver 2.2.12) ]; then + echo "Checking C files for coding style..." + for f in `git ls-files '*.c'`; do + [ "$verbose" -gt 0 ] && echo "checking style on $f" + if ! indent $indent_args -st $f | diff -q $f - >& /dev/null; then + echo " File found with formatting issues: $f" + [ "$verbose" -gt 0 ] 2> /dev/null && indent $indent_args -st $f | diff -u $f - + rc=1 + fi + done + [ "$rc" -gt 0 ] && echo " Run ./tools/iindent on files" +else + echo "You do not have a recent indent installed so your code style is not being checked!" +fi + +if hash grep; then + echo "Checking for dos and whitespace violations..." + for f in $(git ls-files); do + [ "$verbose" -gt 0 ] && echo "checking whitespace on $f" + if grep -q '[[:space:]]$' $f ; then + echo " File found with trailing whitespace: $f" + rc=1 + fi + if grep -q $'\r' $f ; then + echo " File found with dos formatting: $f" + rc=1 + fi + done +fi + +echo "Checking source files for permissions..." +while read -r perm _res0 _res1 f; do + [ -z "$f" ] && continue + [ "$verbose" -gt 0 ] && echo "checking permissions on $f" + if [ "$perm" -ne 100644 ]; then + echo " File found with permissions issue ($perm): $f" + rc=1 + fi +done <<< $(git ls-files -s -- ':(exclude)*.sh' ':(exclude)*iindent') + +echo "Checking script files for permissions..." +while read -r perm _res0 _res1 f; do + [ -z "$f" ] && continue + [ "$verbose" -gt 0 ] && echo "checking permissions on $f" + if [ "$perm" -ne 100755 ]; then + echo " Script found with permissions issue ($perm): $f" + rc=1 + fi +done <<< $(git ls-files -s '*.sh') + + +echo "Checking for signoff in commit message..." +if ! git log -n 1 --format=%B --no-merges | grep -q "^Signed-off-by:" ; then + echo " Commit not signed off. Please read src/CONTRIBUTING.md" + rc=1 +fi + +[ "$rc" -gt 0 ] && echo Format Fail || echo Format Pass + +exit $rc diff --git a/src/isa-l/tools/iindent b/src/isa-l/tools/iindent new file mode 100755 index 000000000..48d26360f --- /dev/null +++ b/src/isa-l/tools/iindent @@ -0,0 +1,2 @@ +#!/bin/sh +indent -linux -l95 -cp1 -lps -il6 -ncs "$@" diff --git a/src/isa-l/tools/nasm-filter.sh b/src/isa-l/tools/nasm-filter.sh new file mode 100755 index 000000000..5ec9ba3f3 --- /dev/null +++ b/src/isa-l/tools/nasm-filter.sh @@ -0,0 +1,47 @@ +#/bin/sh + +# Filter out unnecessary options added by automake + +while [ -n "$*" ]; do + case "$1" in + -f | -o | -D ) + # Supported options with arg + options="$options $1 $2" + shift + shift + ;; + -I | -i ) + options="$options $1 $2/" + shift + shift + ;; + --prefix* ) + # Supported options without arg + options="$options $1" + shift + ;; + -I* | -i* ) + options="$options $1/" + shift + ;; + -D* ) # For defines we need to remove spaces + case "$1" in + *' '* ) ;; + *) options="$options $1" ;; + esac + shift + ;; + #-blah ) + # Unsupported options with args - none known + -* ) + # Unsupported options with no args + shift + ;; + * ) + args="$args $1" + shift + ;; + esac +done + +nasm $options $args diff --git a/src/isa-l/tools/remove_trailing_whitespace.sh b/src/isa-l/tools/remove_trailing_whitespace.sh new file mode 100755 index 000000000..bb82b9fa5 --- /dev/null +++ b/src/isa-l/tools/remove_trailing_whitespace.sh @@ -0,0 +1,2 @@ +#!/bin/sh +sed -i -i.bak 's/[[:blank:]]*$//' "$@" diff --git a/src/isa-l/tools/test_autorun.sh b/src/isa-l/tools/test_autorun.sh new file mode 100755 index 000000000..58d1a0a69 --- /dev/null +++ b/src/isa-l/tools/test_autorun.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +set -e #exit on fail + +# Override defaults if exist +READLINK=readlink +command -V greadlink >/dev/null 2>&1 && READLINK=greadlink + +# Run in build directory +out="$PWD" +src=$($READLINK -f $(dirname $0))/.. +cd "$src" + +# Echo environment info +if test -d .git; then + branch=$(git describe --always) + commitid=$(git rev-parse HEAD) + brief=$(git log -1 --format='%s') + branch_changes=$(git diff --shortstat) +fi +if command -V uname >/dev/null 2>&1; then + node=$(uname -n) + os_name=$(uname -s) + os_all=$(uname -a) +fi + +echo "Test report v1" +echo "branch: $branch" +echo "brief: $brief" +echo "commitid: $commitid" +echo "node: $node" +echo "os_name: $os_name" +echo "os_all: $os_all" +echo "test_args: $@" +echo "changes: $branch_changes" +command -V lscpu > /dev/null 2>&1 && lscpu + +# Start tests + +[ -z "$1" ] && ./tools/test_checks.sh + +while [ -n "$1" ]; do + case "$1" in + check ) + ./tools/test_checks.sh + shift ;; + ext ) + ./tools/test_extended.sh + shift ;; + format ) + shift ;; + all ) + ./tools/test_checks.sh + ./tools/test_extended.sh + shift ;; + * ) + echo $0 undefined option: $1 + shift ;; + esac +done + +./tools/check_format.sh + diff --git a/src/isa-l/tools/test_checks.sh b/src/isa-l/tools/test_checks.sh new file mode 100755 index 000000000..a5a0f45de --- /dev/null +++ b/src/isa-l/tools/test_checks.sh @@ -0,0 +1,115 @@ +#!/usr/bin/env bash + +set -xe #exit on fail + +# Defaults +cpus=1 +S=$RANDOM +MAKE=make +READLINK=readlink + +# Override defaults if exist +command -V gmake >/dev/null 2>&1 && MAKE=gmake +command -V greadlink >/dev/null 2>&1 && READLINK=greadlink + +out="$PWD" +src=$($READLINK -f $(dirname $0))/.. +source $src/tools/test_tools.sh +cd "$src" +tmp_install_dir=$out/tmp_install + +# Run on mult cpus +if command -V lscpu >/dev/null 2>&1; then + cpus=`lscpu -p | tail -1 | cut -d, -f 2` + cpus=$(($cpus + 1)) +elif command -V sysctl; then + if sysctl -n hw.ncpu >/dev/null 2>&1; then + cpus=$(sysctl -n hw.ncpu) + cpus=$(($cpus + 1)) + fi +fi +echo "Using $cpus cpu threads" + +# Pick a random test seed +if [ -z "$S" ]; then + S=`tr -cd 0-9 </dev/urandom | head -c 4 | sed -e 's/^0*/1/g'` + [ "$S" -gt 0 ] 2> /dev/null || S="123" +fi +echo "Running with TEST_SEED=$S" + +# Fix Darwin issues +if uname | grep -q 'Darwin' 2>&1; then + export SED=`which sed` +fi + +# Build and run check tests +if [ -z "$CFLAGS" ]; then + CFLAGS='-g -O2 -fsanitize=undefined -fno-sanitize=nonnull-attribute -fsanitize-undefined-trap-on-error' + + if [ $CC ]; then + echo int main\(\)\{\}\; | $CC $CFLAGS -xc -o /dev/null - >& /dev/null && sanitize=1 + elif ( command -V gcc > /dev/null ); then + echo int main\(\)\{\}\; | gcc $CFLAGS -xc -o /dev/null - >& /dev/null && sanitize=1 + elif ( command -V clang > /dev/null ); then + echo int main\(\)\{\}\; | clang $CFLAGS -xc -o /dev/null - >& /dev/null && sanitize=1 + fi + + if [ $sanitize ]; then + echo "Sanitizing undefined behaviour" + export CFLAGS=$CFLAGS + fi +fi + +time ./autogen.sh +time ./configure --prefix=$tmp_install_dir $opt_config_target +time $MAKE -j $cpus +test_start "check_tests" +time $MAKE check -j $cpus D="-D TEST_SEED=$S" +test_end "check_tests" $? + +# Build other tests if deps found +if command -V ldconfig >/dev/null 2>&1; then + if ldconfig -p | grep -q libz.so; then + test_start "other_check_tests" + time $MAKE other -j $cpus + test_end "other_check_tests" $? + test_start "example_tests" + time $MAKE ex -j $cpus + test_end "example_tests" $? + test_start "unit_tests" + time $MAKE tests -j $cpus + test_end "unit_tests" $? + fi +fi +test_start "installation_test" +time $MAKE install +test_end "installation_test" $? + +# Check for gnu executable stack set +if command -V readelf >/dev/null 2>&1; then + if readelf -W -l $tmp_install_dir/lib/libisal.so | grep 'GNU_STACK' | grep -q 'RWE'; then + echo Stack NX check $tmp_install_dir/lib/libisal.so Fail + exit 1 + else + echo Stack NX check $tmp_install_dir/lib/libisal.so Pass + fi +else + echo Stack NX check not supported +fi + +$MAKE clean + +# Check that make clean did not leave any junk behind +if git status > /dev/null 2>&1; then + if git status --porcelain --ignored | grep -x '.*\.o\|.*\.lo\|.*\.a\|.*\.la\|.*\.s'; then + echo Clean directory check Fail + exit 1 + else + echo Clean directory check Pass + fi +else + echo Clean directory check not supported +fi + + +echo $0: Pass diff --git a/src/isa-l/tools/test_extended.sh b/src/isa-l/tools/test_extended.sh new file mode 100755 index 000000000..8f46a1fbb --- /dev/null +++ b/src/isa-l/tools/test_extended.sh @@ -0,0 +1,208 @@ +#!/usr/bin/env bash + +# Extended tests: Run a few more options other than make check + +set -xe #exit on fail + +# Defaults +cpus=1 +S=$RANDOM +MAKE=make +READLINK=readlink +test_level=check +build_opt='' +msg='' + +# Override defaults if exist +command -V gmake >/dev/null 2>&1 && MAKE=gmake +command -V greadlink >/dev/null 2>&1 && READLINK=greadlink +[ -n "$CC" ] && build_opt+="CC=$CC " +[ -n "$AS" ] && build_opt+="AS=$AS " + +out="$PWD" +src=$($READLINK -f $(dirname $0))/.. +source $src/tools/test_tools.sh +cd "$src" + +# Run on mult cpus +if command -V lscpu >/dev/null 2>&1; then + cpus=`lscpu -p | tail -1 | cut -d, -f 2` + cpus=$(($cpus + 1)) +elif command -V sysctl; then + if sysctl -n hw.ncpu >/dev/null 2>&1; then + cpus=$(sysctl -n hw.ncpu) + cpus=$(($cpus + 1)) + fi +fi +echo "Using $cpus cpu threads" + +if [ -z "$S" ]; then + S=`tr -cd 0-9 </dev/urandom | head -c 4 | sed -e 's/^0*/1/g'` + [ "$S" -gt 0 ] 2> /dev/null || S="123" +fi +msg+="Running with TEST_SEED=$S".$'\n' + +# Fix Darwin issues +if uname | grep -q 'Darwin' 2>&1; then + export SED=`which sed` +fi + +# Check for test libs to add +if command -V ldconfig >/dev/null 2>&1; then + if ldconfig -p | grep -q libz.so; then + test_level=test + msg+=$'With extra tests\n' + fi + if ldconfig -p | grep -q libefence.so; then + build_opt+="LDFLAGS+='-lefence' " + msg+=$'With efence\n' + fi +fi + +# Std makefile build test +$MAKE -f Makefile.unx clean +test_start "extended_build_test" +time $MAKE -f Makefile.unx -j $cpus $build_opt +test_end "extended_build_test" $? +msg+=$'Std makefile build: Pass\n' + +# Check for gnu executable stack set +if command -V readelf >/dev/null 2>&1; then + test_start "stack_nx_check" + if readelf -W -l bin/libisal.so | grep 'GNU_STACK' | grep -q 'RWE'; then + echo $0: Stack NX check bin/libisal.so: Fail + test_end "stack_nx_check" 1 + exit 1 + else + test_end "stack_nx_check" 0 + msg+=$'Stack NX check bin/lib/libisal.so: Pass\n' + fi +else + msg+=$'Stack NX check not supported: Skip\n' +fi + +# Std makefile build perf tests +test_start "extended_perf_test" +time $MAKE -f Makefile.unx -j $cpus perfs +test_end "extended_perf_test" $? +msg+=$'Std makefile build perf: Pass\n' + +# Std makefile run tests +test_start "extended_makefile_tests" +time $MAKE -f Makefile.unx -j $cpus $build_opt D="TEST_SEED=$S" $test_level +test_end "extended_makefile_tests" $? +msg+=$'Std makefile tests: Pass\n' + +# Std makefile build other +test_start "extended_other_tests" +time $MAKE -f Makefile.unx -j $cpus $build_opt D="TEST_SEED=$S" other +test_end "extended_other_tests" $? +msg+=$'Other tests build: Pass\n' + +# Try to pick a random src file +if command -V shuf >/dev/null 2>&1; then + in_file=$(find $src -type f -size +0 -name \*.c -o -name \*.asm -print 2>/dev/null | shuf | head -1 ); +else + in_file=configure.ac +fi + +echo Other tests using $in_file +test_start "igzip_file_perf" +./igzip_file_perf $in_file +test_end "igzip_file_perf" $? +test_start "igzip_hist_perf" +./igzip_hist_perf $in_file +test_end "igzip_hist_perf" $? +test_start "igzip_semi_dyn_file_perf" +./igzip_semi_dyn_file_perf $in_file +test_end "igzip_semi_dyn_file_perf" $? +test_start "igzip_fuzz_inflate" +./igzip_fuzz_inflate $in_file +test_end "igzip_fuzz_inflate" $? +msg+=$'Other tests run: Pass\n' + +if command -V shuf >/dev/null 2>&1; then + in_files=$(find $src -type f -size +0 -print 2>/dev/null | shuf | head -10 ); + test_start "igzip_rand_test" + ./igzip_rand_test $in_files + test_end "igzip_rand_test" $? + test_start "igzip_inflate_test" + ./igzip_inflate_test $in_files + test_end "igzip_inflate_test" $? + msg+=$'Compression file tests: Pass\n' +else + msg+=$'Compression file test: Skip\n' +fi + +time $MAKE -f Makefile.unx -j $cpus $build_opt ex +msg+=$'Examples build: Pass\n' + +test_start "ec_simple_example" +./ec_simple_example -r $S +test_end "ec_simple_example" $? +test_start "crc_simple_test" +./crc_simple_test +test_end "crc_simple_test" $? +test_start "crc64_example" +./crc64_example +test_end "crc64_example" $? +test_start "xor_example" +./xor_example +test_end "xor_example" $? +test_start "igzip_example" +./igzip_example ${in_file} ${in_file}.cmp +test_end "igzip_example" $? +rm -rf ${in_file}.cmp +msg+=$'Examples run: Pass\n' + +# Test custom hufftables +test_start "generate_custom_hufftables" +./generate_custom_hufftables $in_file +$MAKE -f Makefile.unx -j $cpus D="NO_STATIC_INFLATE_H" checks +./igzip_rand_test $in_file +./generate_static_inflate +diff -q static_inflate.h igzip/static_inflate.h +rm -rf static_inflate.h +rm -rf hufftables_c.c +test_end "generate_custom_hufftables" $? + +msg+=$'Custom hufftable build: Pass\n' + +$MAKE -f Makefile.unx clean + +# noarch build +test_start "noarch_build" +time $MAKE -f Makefile.unx -j $cpus arch=noarch $build_opt +test_end "noarch_build" $? +test_start "noarch_build_random" +time $MAKE -f Makefile.unx -j $cpus arch=noarch $build_opt D="TEST_SEED=$S" check +test_end "noarch_build_random" $? +$MAKE -f Makefile.unx arch=noarch clean +msg+=$'Noarch build: Pass\n' + +# Try mingw build +if [ $(uname -m) == "x86_64" ] && command -V x86_64-w64-mingw32-gcc >/dev/null 2>&1; then + test_start "mingw_build" + time $MAKE -f Makefile.unx -j $cpus arch=mingw + test_end "mingw_build" $? + msg+=$'Mingw build: Pass\n' + + if command -V wine >/dev/null 2>&1; then + test_start "mingw_check_tests" + time $MAKE -f Makefile.unx -j $cpus arch=mingw D="TEST_SEED=$S" check + test_end "mingw_check_tests" $? + msg+=$'Mingw check tests: Pass\n' + else + msg+=$'No wine, mingw check: Skip\n' + fi + $MAKE -f Makefile.unx arch=mingw clean +else + msg+=$'No mingw build: Skip\n' +fi + +set +x +echo +echo "Summary test $0:" +echo "Build opt: $build_opt" +echo "$msg" +echo "$0: Final: Pass" diff --git a/src/isa-l/tools/test_fuzz.sh b/src/isa-l/tools/test_fuzz.sh new file mode 100755 index 000000000..bc9797e57 --- /dev/null +++ b/src/isa-l/tools/test_fuzz.sh @@ -0,0 +1,171 @@ +#!/usr/bin/env bash + +usage () +{ +test_ids=$(echo "${llvm_all_ids[*]}" | sed 's/ /, /g') +cat << EOF +usage: $0 options +options: + -h Help + -l, --llvm <n> Use llvm fuzz tests and run n times 0=just build, -1=skip (default $use_llvm). + -a, --afl <n> Use AFL fuzz tests and run n times 0=just build, -1=skip (default $use_afl). + -t, --time <n> Run each group of max time <n>[s,h,m,d] - n seconds, hours, minutes or days. + -e <exec|rand|all> Run a specific llvm test or [$test_ids, rand, all]. + -f <file> Use this file as initial raw input. Can be repeated. + -d <0,1> Use dump of internal inflate test corpus (default $use_internal_corp). + -i <dir> Fuzz input dir (default $fuzzin_dir). + -o <dir> Fuzz output dir (default $fuzzout_dir). +EOF +exit 0 +} + +# Defaults +use_afl=-1 +use_llvm=1 +samp_files= +use_internal_corp=0 +fuzzin_dir=fuzzin +fuzzout_dir=fuzzout +llvm_opts=" -print_final_stats=1" +afl_timeout_cmd="" +run_secs=0 +llvm_tests=("igzip_simple_inflate_fuzz_test") +llvm_all_ids=("simple" "checked" "round_trip") +llvm_all_tests=("igzip_simple_inflate_fuzz_test" "igzip_checked_inflate_fuzz_test" "igzip_simple_round_trip_fuzz_test") + +# Options +while [ "$1" != "${1##-}" ]; do + case $1 in + -h | --help) + usage + ;; + -t | --time) + run_secs=$(echo $2 | sed -e 's/d$/*24h/' -e 's/h$/*60m/' -e 's/m$/*60/' -e 's/s$//'| bc) + llvm_opts+=" -max_total_time=$run_secs" + afl_timeout_cmd="timeout --preserve-status $run_secs" + echo Run each for $run_secs seconds + shift 2 + ;; + -a | --afl) + use_afl=$2 + shift 2 + ;; + -l | --llvm) + use_llvm=$2 + shift 2 + ;; + -f) + samp_files+="$2 " + use_internal_corp=0 + shift 2 + ;; + -d) + use_internal_corp=$2 + shift 2 + ;; + -e) + case $2 in + all) + llvm_tests=${llvm_all_tests[@]} + ;; + rand) + llvm_tests=${llvm_all_tests[$RANDOM % ${#llvm_all_tests[@]} ]} + ;; + *) + flag=0 + for id_index in "${!llvm_all_ids[@]}"; do + if [[ "${llvm_all_ids[$id_index]}" = "$2" ]]; then + flag=1 + llvm_tests[0]="${llvm_all_tests[$id_index]}" + break; + fi + done + + if [ $flag -eq 0 ]; then + test_ids=$(echo "${llvm_all_ids[*]}" | sed 's/ /, /g') + echo "Invalid test, valid options: $test_ids, rand, or all" + exit 0 + fi + ;; + esac + shift 2 + ;; + -i) + fuzzin_dir=$2 + shift 2 + ;; + -o) + fuzzout_dir=$2 + shift 2 + ;; + esac +done + +set -xe #exit on fail + +# Optionally build afl fuzz tests +if [ $use_afl -ge 0 ]; then + echo Build afl fuzz tests + if ! command -V afl-gcc > /dev/null; then + echo $0 option --afl requires package afl installed + exit 0 + fi + make -f Makefile.unx clean + make -f Makefile.unx units=igzip CC=afl-gcc other +fi + +# Optionally build llvm fuzz tests +if [ $use_llvm -ge 0 ]; then + echo Build llvm fuzz tests + if ( command -V clang++ > /dev/null ); then + if (echo int LLVMFuzzerTestOneInput\(\)\{return 0\;\} | clang++ -x c - -fsanitize=fuzzer,address -lpthread -o /dev/null >& /dev/null); then + echo have modern clang + llvm_link_args='FUZZLINK=-fsanitize=fuzzer,address' + elif (echo int LLVMFuzzerTestOneInput\(\)\{return 0\;\} | clang++ -x c - -lFuzzer -lpthread -o /dev/null >& /dev/null); then + echo have libFuzzer + llvm_link_args='FUZZLINK=-lFuzzer' + else + echo $0 option --llvm requires clang++ and libFuzzer + exit 0 + fi + fi + rm -rf bin + make -f Makefile.unx units=igzip llvm_fuzz_tests igzip_dump_inflate_corpus CC=clang CXX=clang++ ${llvm_link_args} +fi + +#Create fuzz input/output directories +mkdir -p $fuzzin_dir +if [ $use_afl -ge 0 ]; then + mkdir -p $fuzzout_dir +fi + +# Optionally fill fuzz input with internal tests corpus +[ $use_internal_corp -gt 0 ] && ./igzip_dump_inflate_corpus $fuzzin_dir + +# Optionally compress input samples as input into fuzz dir +for f in $samp_files; do + echo Using sample file $f + f_base=`basename $f` + ./igzip_file_perf $f -o $fuzzin_dir/samp_${f_base}_cmp +done + +# Optionally run tests alternately one after the other +while [ $use_llvm -gt 0 -o $use_afl -gt 0 ]; do + if [ $use_afl -gt 0 ]; then + echo afl run $use_afl + let use_afl-- + $afl_timeout_cmd afl-fuzz -T "Run inflate $run_secs s" -i $fuzzin_dir -o $fuzzout_dir -M fuzzer1 -- ./igzip_fuzz_inflate @@ + afl-whatsup $fuzzout_dir + fi + + if [ $use_llvm -gt 0 ]; then + echo llvm run $use_llvm + let use_llvm-- + for test in $llvm_tests; do + echo "Run llvm test $test" + ./$test $fuzzin_dir $llvm_opts + done + fi +done + +make -f Makefile.unx clean diff --git a/src/isa-l/tools/test_tools.sh b/src/isa-l/tools/test_tools.sh new file mode 100755 index 000000000..448b1f92b --- /dev/null +++ b/src/isa-l/tools/test_tools.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +function test_start() +{ + echo "entering test: $1" +} + +function test_end() +{ + echo "leaving test: $1 status: $2" +} diff --git a/src/isa-l/tools/yasm-filter.sh b/src/isa-l/tools/yasm-filter.sh new file mode 100755 index 000000000..c33952a40 --- /dev/null +++ b/src/isa-l/tools/yasm-filter.sh @@ -0,0 +1,38 @@ +#/bin/sh + +# Filter out unnecessary options added by automake + +while [ -n "$*" ]; do + case "$1" in + -f | -o | -I | -i | -D ) + # Supported options with arg + options="$options $1 $2" + shift + shift + ;; + -I* | -i* | --prefix* ) + # Supported options without arg + options="$options $1" + shift + ;; + -D* ) # For defines we need to remove spaces + case "$1" in + *' '* ) ;; + *) options="$options $1" ;; + esac + shift + ;; + #-blah ) + # Unsupported options with args - none known + -* ) + # Unsupported options with no args + shift + ;; + * ) + args="$args $1" + shift + ;; + esac +done + +yasm $options $args |