Skip to content

Commit

Permalink
Some fixes/cleanup for the test script
Browse files Browse the repository at this point in the history
  • Loading branch information
zrax committed Aug 30, 2016
1 parent 71b670d commit 830bb0d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ install(TARGETS pycdc
RUNTIME DESTINATION bin)

# For tests
add_custom_target(test ${CMAKE_CURRENT_SOURCE_DIR}/pycdc_test.sh
${CMAKE_CURRENT_SOURCE_DIR}/tests)
add_custom_target(test "${CMAKE_CURRENT_SOURCE_DIR}/pycdc_test.sh"
"${CMAKE_CURRENT_SOURCE_DIR}/tests"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_dependencies(test pycdc)
19 changes: 10 additions & 9 deletions pycdc_test.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
#!/bin/bash

testdir="$1"
mkdir -p tests

fails=0
files=()
errors=()
for f in $1/*.pyc
for f in "$testdir"/*.pyc
do
base=tests/$( basename "$f" )
stderr=$( ./pycdc "$f" 2>$base.err 1>$base.src )
if [ "$?" -eq "0" -a -z "$stderr" ]
base="tests/$(basename "$f")"
./pycdc "$f" 2>"$base.err" 1>"$base.src"
if (( $? )) || [[ -s "$base.err" ]]
then
echo -ne "\033[32m.\033[m"
else
let fails+=1
files=("${files[@]}" "$f")
errors=("${errors[@]}" "$stderr")
files+=("$f")
errors+=("$(cat "$base.err")")
echo -ne "\033[31m.\033[m"
else
echo -ne "\033[32m.\033[m"
fi
done
echo -e "\n\n$fails tests failed:"
for ((i=0; i<${#files[@]}; i++))
do
echo -e "\t\033[31m${files[i]}\033[m"
echo -e "${errors[i]}\n"
echo -e "${errors[i]}\n"
done

0 comments on commit 830bb0d

Please sign in to comment.