Skip to content

Commit

Permalink
Add create_io_test.sh to easyliy create tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Ulmer committed Nov 28, 2024
1 parent 027ecb4 commit 505fe19
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
36 changes: 36 additions & 0 deletions buildscripts/create_io_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/env bash

cd $(dirname $0)/..

program_file=$1 ; shift
test_number=$(printf "%02d" $1) ; shift

printf "Creating test number %s for program %s\n" ${test_number} ${program_file}

if ! [ -x ${program_file} ]; then
program_file=./build/${program_file};
fi

if ! [ -x ${program_file} ]; then
echo program file not executeable 1>&2
exit 1
fi

if [ ${test_number} -lt 0 ] || [ ${test_number} -gt 99 ]; then
echo invalid test number 1>&2
exit 2
fi

test_dir=./tests/io_tests/$(basename ${program_file})/

[ -d ${test_dir} ] || mkdir -p ${test_dir}

in_file=${test_dir}${test_number}.in
out_file=${test_dir}${test_number}.out
err_file=${test_dir}${test_number}.err

rm -f ${in_file}
rm -f ${out_file}
rm -f ${err_file}

tee ${in_file} | stdbuf -o0 ${program_file} 2> ${err_file} | tee ${out_file}
2 changes: 1 addition & 1 deletion buildscripts/criterion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cmake --build . --target $(basename ${criterion_target})

out_file="./$(dirname ${criterion_target})/Testing/$(basename ${criterion_target}).out"

timeout 10 ./${criterion_target} > ${out_file} 2>&1 || {
timeout 10 ./${criterion_target} --verbose > ${out_file} 2>&1 || {
tail -n 10 ${out_file}
rm -f ${out_file}
exit 2
Expand Down
1 change: 0 additions & 1 deletion compile_commands.json

This file was deleted.

0 comments on commit 505fe19

Please sign in to comment.