| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | # Author: |
| 4 | # Martin Preisler <[email protected]> |
| 5 | # Dominique Blaze <[email protected]> |
| 6 | # |
| 7 | # All tests use import_handler.py as import manager |
| 8 | # in order to ensure that the tested module come from the tested env |
| 9 | # and not from an existing local/other installation. |
| 10 | # Read import_handler.py comments to learn more. |
| 11 | |
| 12 | . $builddir/tests/test_common.sh |
| 13 | |
| 14 | # Test Cases. |
| 15 | |
| 16 | function test_python_importscip-shell shell shell-project 0.0.0 test_python_import(). { |
| 17 | bashscip-shell system . . bash. $builddir/run python3 "${srcdir}/python/import_handler.py" |
| 18 | } |
| 19 | |
| 20 | function run_pyfilescip-shell shell shell-project 0.0.0 run_pyfile(). () { |
| 21 | echoscip-shell system . . echo. "$builddir/run python3 ${srcdir}/python/$1" |
| 22 | bashscip-shell system . . bash. $builddir/run python3 "${srcdir}/python/$1" |
| 23 | } |
| 24 | |
| 25 | # Testing. |
| 26 | test_init |
| 27 | |
| 28 | # used by oval checks |
| 29 | echoscip-shell system . . echo. "Hello World !" > /tmp/foo_python.txtscip-shell filesystem . . `/tmp/foo_python.txt`. |
| 30 | |
| 31 | if [scip-shell system . . `[`. -z ${CUSTOM_OSCAP+x} ] ; then |
| 32 | # first test only the openscap_api module loading |
| 33 | test_run "python_import" test_python_import |
| 34 | |
| 35 | test_run "python_benchmark_import_results" run_pyfile benchmark_import_results.py |
| 36 | test_run "python_oval_eval" run_pyfile oval_eval.py |
| 37 | test_run "python_introspection_features" run_pyfile introspection_features.py |
| 38 | test_run "python_xccdf_policy" run_pyfile xccdf_policy.py |
| 39 | test_run "python_xccdf_evaluation" run_pyfile xccdf_evaluation.py |
| 40 | test_run "python_xccdf_single_evaluation" run_pyfile xccdf_single_evaluation.py |
| 41 | fi |
| 42 | |
| 43 | rmscip-shell system . . rm. /tmp/foo_python.txtscip-shell filesystem . . `/tmp/foo_python.txt`. |
| 44 | |
| 45 | test_exit |