Finish removing old tests and old "test" framework.

This commit is contained in:
Michael Hansen
2019-10-07 20:57:43 -07:00
parent 391ba6502d
commit 44af6a2c04
9 changed files with 61 additions and 106 deletions

View File

@@ -57,16 +57,6 @@ target_link_libraries(pycdc pycxx)
install(TARGETS pycdc
RUNTIME DESTINATION bin)
add_custom_target(dc_test "${CMAKE_CURRENT_SOURCE_DIR}/pycdc_test.sh"
"${CMAKE_CURRENT_SOURCE_DIR}/tests"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_dependencies(dc_test pycdc)
add_custom_target(rt_test "${CMAKE_CURRENT_SOURCE_DIR}/pycdc_rt_test.sh"
"${CMAKE_CURRENT_BINARY_DIR}/tests"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_dependencies(rt_test dc_test)
add_custom_target(check "${CMAKE_CURRENT_SOURCE_DIR}/tests/all_tests.sh"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_dependencies(check pycdc)

View File

@@ -1,55 +0,0 @@
#!/bin/bash
testdir="$1"
srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
startdir="$(pwd)"
if [[ -z "$testdir" ]]; then
echo "Missing required parameter: testdir" >&2
exit 1
fi
if [[ ! -d "$testdir" ]]; then
echo "Test directory $testdir does not exist" >&2
exit 1
fi
cd "$testdir"
# Run any .pyc.src files in $testdir back through its respective python compiler
fails=0
files=()
errors=()
shopt -s nullglob
rtsources=(*.pyc.src.py)
shopt -u nullglob
if (( ${#rtsources[@]} == 0 )); then
echo "No decompyled sources found in $testdir"
exit 1
fi
for srcf in "${rtsources[@]}"; do
# There's probably a better way...
srcver=$(grep '# File: .* (Python [0-9]\.[0-9]\+)$' "$srcf" | sed -e 's/.* (Python //' -e 's/)//')
base="$(basename "$srcf")"
"$srcdir"/scripts/pymultic "$srcver" "$srcf" 2> "$base.rterr"
if (( $? )) || [[ -s "$base.rterr" ]]; then
let fails+=1
files+=("$srcf")
errors+=("$(cat "$base.rterr")")
fi
done
if (( $fails == 0 ))
then
echo -e "\n\nAll tests passed!"
else
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"
done
fi

View File

@@ -1,41 +0,0 @@
#!/bin/bash
testdir="$1"
if [[ -z "$testdir" ]]
then
echo "Missing required parameter: testdir" >&2
exit 1
fi
mkdir -p tests
fails=0
files=()
errors=()
for f in "$testdir"/*.pyc
do
base="tests/$(basename "$f")"
./pycdc "$f" 2>"$base.err" 1>"$base.src.py"
if (( $? )) || [[ -s "$base.err" ]]
then
let fails+=1
files+=("$f")
errors+=("$(cat "$base.err")")
echo -ne "\033[31m.\033[m"
else
echo -ne "\033[32m.\033[m"
fi
done
if (( $fails == 0 ))
then
echo -e "\n\nAll tests passed!"
else
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"
done
fi

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,26 @@
def x0():
pass
def x1(arg1):
pass
def x2(arg1, arg2):
pass
def x3a(*args):
pass
def x3b(**kwargs):
pass
def x3c(*args, **kwargs):
pass
def x4a(foo, bar = 1, bla = 2, *args):
pass
def x4b(foo, bar = 1, bla = 2, **kwargs):
pass
def x4c(foo, bar = 1, bla = 2, *args, **kwargs):
pass

View File

@@ -0,0 +1,35 @@
def x0 ( ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x1 ( arg1 ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x2 ( arg1 , arg2 ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x3a ( * args ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x3b ( ** kwargs ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x3c ( * args , ** kwargs ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x4a ( foo , bar = 1 , bla = 2 , * args ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x4b ( foo , bar = 1 , bla = 2 , ** kwargs ) : <EOL>
<INDENT>
pass <EOL>
<OUTDENT>
def x4c ( foo , bar = 1 , bla = 2 , * args , ** kwargs ) : <EOL>
<INDENT>
pass <EOL>

Binary file not shown.