-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kill the old internal testing tools in favor of XEET. Also modifies the way packages are tests (though the jist of it remains the same). Signed-off-by: Omer Caspi <omer.caspi@gmail.com>
- Loading branch information
Showing
105 changed files
with
551 additions
and
411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
scripts/diff_test_output.sh |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
_abort() | ||
{ | ||
echo "ERROR: $1" | ||
exit 1 | ||
} | ||
|
||
PROJ_ROOT=$(git rev-parse --show-toplevel 2>/dev/null) | ||
[[ -z "${PROJ_ROOT}" ]] && _abort "Could not find project root. Are you in the project directory?" | ||
|
||
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
cd ${HERE} || _abort "Could not cd to ${HERE}" | ||
|
||
if [[ -z "${VENV_ACTIVATE}" ]]; then | ||
source ${PROJ_ROOT}/.venv/bin/activate || _abort "ERROR: Could not activate virtualenv" | ||
fi | ||
|
||
cmd="xeet run -c xeet.json $*" | ||
echo "Running: ${cmd}" | ||
${cmd} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
cd ${DIR} || exit 1 | ||
|
||
echoerr() | ||
{ | ||
echo "$@" 1>&2; | ||
} | ||
|
||
require_var() | ||
{ | ||
local var_name=$1 | ||
#make sure the variable is set | ||
if [[ -z ${!var_name} ]]; then | ||
echoerr "Missing variable ${var_name}" | ||
exit 1 | ||
fi | ||
} | ||
|
||
require_dir() | ||
{ | ||
local dir_name=$1 | ||
#make sure the variable is set | ||
if [[ ! -d ${dir_name} ]]; then | ||
echoerr "Missing directory ${dir_name}" | ||
exit 1 | ||
fi | ||
} | ||
|
||
require_dir_var() | ||
{ | ||
local dir_var_name=$1 | ||
require_var ${dir_var_name} | ||
require_dir ${!dir_var_name} | ||
} | ||
|
||
require_file() | ||
{ | ||
local file_name=$1 | ||
local file_name_pr=${file_name#"${XEET_ROOT}/"} | ||
#make sure the variable is set | ||
if [[ ! -f ${file_name} ]]; then | ||
echoerr "Missing file: ${file_name_pr}" | ||
exit 1 | ||
fi | ||
} | ||
|
||
require_not_file() | ||
{ | ||
local file_name=$1 | ||
#make sure the variable is set | ||
if [[ -f ${file_name} ]]; then | ||
echoerr "File ${file_name} should not exist" | ||
exit 1 | ||
fi | ||
} | ||
|
||
require_var XEET_TEST_NAME | ||
require_var XEET_TEST_DEBUG | ||
|
||
require_dir_var XEET_TEST_OUTPUT_DIR | ||
require_dir_var XEET_ROOT | ||
|
||
TEST_EXPECTED_DIR=${XEET_ROOT}/xeet.expected/${XEET_TEST_NAME} | ||
|
||
_compare_file() | ||
{ | ||
local expected_file=$1 | ||
local out_file=$2 | ||
local expected_file_pr=${expected_file#"${XEET_ROOT}/"} | ||
local out_file_pr=${out_file#"${XEET_ROOT}/"} | ||
|
||
if [[ -f ${expected_file} ]]; then | ||
require_file ${out_file} | ||
else | ||
if [[ ! -f ${out_file} ]]; then | ||
return 0 | ||
fi | ||
fi | ||
|
||
if [[ -f ${out_file} ]]; then | ||
require_file ${expected_file} | ||
else | ||
require_not_file ${expected_file} | ||
fi | ||
|
||
if diff -q ${out_file} ${expected_file} &> /dev/null; then | ||
echo "File ${out_file_pr} matches expected output" | ||
else | ||
echoerr "Files ${out_file_pr} and ${expected_file_pr} do not match" | ||
echoerr "Diff saved to ${out_file_pr}.diff" | ||
diff -u ${out_file} ${expected_file} &> ${out_file}.diff | ||
return 1 | ||
fi | ||
} | ||
|
||
generic_stdout_test() | ||
{ | ||
if [[ ${XEET_TEST_DEBUG} == "1" ]]; then | ||
echo "Running in debug mode, skipping stdout comparison" | ||
return 0 | ||
fi | ||
_compare_file ${TEST_EXPECTED_DIR}/stdout ${XEET_TEST_OUTPUT_DIR}/stdout | ||
_compare_file ${TEST_EXPECTED_DIR}/stderr ${XEET_TEST_OUTPUT_DIR}/stderr | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
# shellcheck disable=SC2034 | ||
EXPECTED_BASE_DIR=xeet.expected | ||
OUT_BASE_DIR=xeet.out | ||
OUTPUT_FILES="stdout stderr" | ||
|
||
echoerr() | ||
{ | ||
echo "$@" 1>&2; | ||
} | ||
warn() | ||
{ | ||
local args="$*" | ||
|
||
# print warning in yellow | ||
echo -e "\033[33m${args}033[0m" | ||
} | ||
abort() | ||
{ | ||
echoerr Aborting: "$*" | ||
exit 1 | ||
} | ||
|
||
_get_test_dir() | ||
{ | ||
local base_dir=$1 | ||
local test_name=$2 | ||
|
||
if [[ -d ${base_dir}/${test_name} ]]; then | ||
echo ${base_dir}/${test_name} | ||
else | ||
readarray -t test_directories < <(find ${base_dir} -name "${test_name}*" -type d -printf "%f\n") | ||
if [[ ${#test_directories[@]} -eq 0 ]]; then | ||
echo "No directory found for test ${test_name} in ${base_dir}" | ||
return 1 | ||
fi | ||
|
||
if [[ ${#test_directories[@]} -gt 1 ]]; then | ||
echo "Multiple directories found for test ${test_name} in ${base_dir}" | ||
return 1 | ||
fi | ||
echo ${base_dir}/${test_directories[0]} | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -e | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
source ${DIR}/common.inc.sh | ||
|
||
generic_stdout_test |
Oops, something went wrong.