diff options
| author | Virgil Dupras <hsoft@hardcoded.net> | 2018-08-15 10:26:51 -0400 |
|---|---|---|
| committer | Virgil Dupras <hsoft@hardcoded.net> | 2018-08-15 10:26:51 -0400 |
| commit | e046d875a0bc655c522fc30760e61c8b2b3408d8 (patch) | |
| tree | fbe3276280258bbe9414b47b1282483bd8a40384 /cmdtests/runtests.sh | |
| parent | 8d0df18f0275376a5c7e6c133abaa99e7c05b737 (diff) | |
| download | gentoolkit-e046d875a0bc655c522fc30760e61c8b2b3408d8.tar.gz | |
Add functional tests through "cmdtests"
These tests run a list of commands on both the system gentoolkit and the
source from the active work directory, and then compares the results.
It's a great way to verify that a refactoring didn't introduce an
unwanted change in behavior.
Diffstat (limited to 'cmdtests/runtests.sh')
| -rwxr-xr-x | cmdtests/runtests.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cmdtests/runtests.sh b/cmdtests/runtests.sh new file mode 100755 index 0000000..ba0ff22 --- /dev/null +++ b/cmdtests/runtests.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +TEST_AGAINST_PYTHON_PATH=$1 + +while read -r line; do + echo "Running $line > before" + PYTHONPATH="${TEST_AGAINST_PYTHON_PATH}" + eval "$line" > before || exit 1 + echo "Running $line > after" + PYTHONPATH="../pym" + eval "$line" > after || exit 1 + DIFF=$(diff -u before after) + if [[ -n $DIFF ]]; then + echo "Different!" + echo "$DIFF" + exit 1 + fi +done < cmds.txt + +rm before after +echo "All commands output the exact same thing!" |
