Some fixes/cleanup for the test script
This commit is contained in:
@@ -61,6 +61,7 @@ install(TARGETS pycdc
|
|||||||
RUNTIME DESTINATION bin)
|
RUNTIME DESTINATION bin)
|
||||||
|
|
||||||
# For tests
|
# For tests
|
||||||
add_custom_target(test ${CMAKE_CURRENT_SOURCE_DIR}/pycdc_test.sh
|
add_custom_target(test "${CMAKE_CURRENT_SOURCE_DIR}/pycdc_test.sh"
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/tests)
|
"${CMAKE_CURRENT_SOURCE_DIR}/tests"
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
add_dependencies(test pycdc)
|
add_dependencies(test pycdc)
|
||||||
|
@@ -1,27 +1,28 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
testdir="$1"
|
||||||
mkdir -p tests
|
mkdir -p tests
|
||||||
|
|
||||||
fails=0
|
fails=0
|
||||||
files=()
|
files=()
|
||||||
errors=()
|
errors=()
|
||||||
for f in $1/*.pyc
|
for f in "$testdir"/*.pyc
|
||||||
do
|
do
|
||||||
base=tests/$( basename "$f" )
|
base="tests/$(basename "$f")"
|
||||||
stderr=$( ./pycdc "$f" 2>$base.err 1>$base.src )
|
./pycdc "$f" 2>"$base.err" 1>"$base.src"
|
||||||
if [ "$?" -eq "0" -a -z "$stderr" ]
|
if (( $? )) || [[ -s "$base.err" ]]
|
||||||
then
|
then
|
||||||
echo -ne "\033[32m.\033[m"
|
|
||||||
else
|
|
||||||
let fails+=1
|
let fails+=1
|
||||||
files=("${files[@]}" "$f")
|
files+=("$f")
|
||||||
errors=("${errors[@]}" "$stderr")
|
errors+=("$(cat "$base.err")")
|
||||||
echo -ne "\033[31m.\033[m"
|
echo -ne "\033[31m.\033[m"
|
||||||
|
else
|
||||||
|
echo -ne "\033[32m.\033[m"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo -e "\n\n$fails tests failed:"
|
echo -e "\n\n$fails tests failed:"
|
||||||
for ((i=0; i<${#files[@]}; i++))
|
for ((i=0; i<${#files[@]}; i++))
|
||||||
do
|
do
|
||||||
echo -e "\t\033[31m${files[i]}\033[m"
|
echo -e "\t\033[31m${files[i]}\033[m"
|
||||||
echo -e "${errors[i]}\n"
|
echo -e "${errors[i]}\n"
|
||||||
done
|
done
|
||||||
|
Reference in New Issue
Block a user