1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
#!/bin/bash
# Info tool testing script
#
# Version: 20200705
EXIT_SUCCESS=0;
EXIT_FAILURE=1;
EXIT_IGNORE=77;
PROFILES=("vmdkinfo");
OPTIONS_PER_PROFILE=("");
OPTION_SETS="";
INPUT_GLOB="*";
if test -n "${SKIP_TOOLS_TESTS}" || test -n "${SKIP_TOOLS_END_TO_END_TESTS}";
then
exit ${EXIT_IGNORE};
fi
TEST_EXECUTABLE="../vmdktools/vmdkinfo";
if ! test -x "${TEST_EXECUTABLE}";
then
TEST_EXECUTABLE="../vmdktools/vmdkinfo.exe";
fi
if ! test -x "${TEST_EXECUTABLE}";
then
echo "Missing test executable: ${TEST_EXECUTABLE}";
exit ${EXIT_FAILURE};
fi
TEST_RUNNER="tests/test_runner.sh";
if ! test -f "${TEST_RUNNER}";
then
TEST_RUNNER="./test_runner.sh";
fi
if ! test -f "${TEST_RUNNER}";
then
echo "Missing test runner: ${TEST_RUNNER}";
exit ${EXIT_FAILURE};
fi
source ${TEST_RUNNER};
if ! test -d "input";
then
echo "Test input directory not found.";
exit ${EXIT_IGNORE};
fi
RESULT=`ls input/* | tr ' ' '\n' | wc -l`;
if test ${RESULT} -eq ${EXIT_SUCCESS};
then
echo "No files or directories found in the test input directory";
exit ${EXIT_IGNORE};
fi
for PROFILE_INDEX in ${!PROFILES[*]};
do
TEST_PROFILE=${PROFILES[${PROFILE_INDEX}]};
TEST_PROFILE_DIRECTORY=$(get_test_profile_directory "input" "${TEST_PROFILE}");
IGNORE_LIST=$(read_ignore_list "${TEST_PROFILE_DIRECTORY}");
IFS=" " read -a OPTIONS <<< ${OPTIONS_PER_PROFILE[${PROFILE_INDEX}]};
RESULT=${EXIT_SUCCESS};
for TEST_SET_INPUT_DIRECTORY in input/*;
do
if ! test -d "${TEST_SET_INPUT_DIRECTORY}";
then
continue;
fi
TEST_SET=`basename ${TEST_SET_INPUT_DIRECTORY}`;
if check_for_test_set_in_ignore_list "${TEST_SET}" "${IGNORE_LIST}";
then
continue;
fi
TEST_SET_DIRECTORY=$(get_test_set_directory "${TEST_PROFILE_DIRECTORY}" "${TEST_SET_INPUT_DIRECTORY}");
run_test_on_test_set_with_options "${TEST_SET_DIRECTORY}" "vmdkinfo" "with_stdout_reference" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${OPTIONS[@]}";
RESULT=$?;
# Ignore failures due to corrupted data.
if test "${TEST_SET}" = "corrupted";
then
RESULT=${EXIT_SUCCESS};
fi
if test ${RESULT} -ne ${EXIT_SUCCESS};
then
break;
fi
done
done
exit ${RESULT};
|