diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b2dd1bfb693f81baee5d0f2bf47c82b8d27b5b10..1a3a2754b63b77d23b701a0d98d1ed2c4829277b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -145,3 +145,34 @@ xform-cat-centos75: variables: OS: 'centos75' +# +# elfdep test +# + +# template +.elfdep: &elfdep + stage: test + script: + - ./cicd_tests/elfdep.sh + +elfdep-ubuntu18: + <<: *elfdep + tags: + - ubuntu18 + variables: + OS: 'ubuntu18' + +elfdep-ubuntu16: + <<: *elfdep + tags: + - ubuntu16 + variables: + OS: 'ubuntu16' + +elfdep-centos75: + <<: *elfdep + tags: + - centos75 + variables: + OS: 'centos75' + diff --git a/cicd_tests/elfdep.sh b/cicd_tests/elfdep.sh new file mode 100755 index 0000000000000000000000000000000000000000..9ba43c87cd0d7e134e0a9b54f5278e6faed9c0c7 --- /dev/null +++ b/cicd_tests/elfdep.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -e +set -x + +cd $CICD_MODULE_WORK_DIR/peasoup_umbrella +source set_env_vars + +cd $SECURITY_TRANSFORMS_HOME/libElfDep/test/ +./test-elfdep.sh diff --git a/libElfDep/test/test-elfdep.sh b/libElfDep/test/test-elfdep.sh new file mode 100755 index 0000000000000000000000000000000000000000..39ac850f75d329f0223c1f2e177835917710a161 --- /dev/null +++ b/libElfDep/test/test-elfdep.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +TMP_ORIG=/tmp/testelfdep.ls.orig.$$ +TMP_ORIG2=/tmp/testelfdep.ls.orig.2.$$ +TMP_ELFDEP=/tmp/testelfdep.ls.elfdep.$$ + +cleanup_files() +{ + rm /tmp/testelfdep.ls* >/dev/null 2>&1 +} + +cleanup() +{ + echo "************" + echo "test failed." + echo "************" + + cleanup_files + exit 1 +} + + +# make sure xforms are built +scons || cleanup + +$PSZ /bin/ls ./xxx -c move_globals=on -o move_globals:--elftables -c edt=on || cleanup + +/bin/ls /tmp > $TMP_ORIG || cleanup + +./xxx /tmp > $TMP_ELFDEP || cleanup + +echo "Verify external vars was overwritten" +grep "var = 0" $TMP_ELFDEP || cleanup +grep "var = 1" $TMP_ELFDEP || cleanup + +echo "Verify same output" +grep -v "var =" $TMP_ELFDEP > $TMP_ORIG2 +diff $TMP_ORIG2 $TMP_ELFDEP + +cleanup_files + +echo +echo "test passed." +echo diff --git a/libElfDep/test/testit.sh b/libElfDep/test/testit.sh deleted file mode 100755 index 051b6c0133b5fc47f9a961516065161c9533ccdb..0000000000000000000000000000000000000000 --- a/libElfDep/test/testit.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -cleanup() -{ - echo "************" - echo "test failed." - echo "************" - exit 1 -} - - -# make sure xforms are built -scons || cleanup - -$PSZ /bin/ls ./xxx -c move_globals=on -o move_globals:--elftables -c edt=on || cleanup - -/bin/ls /tmp || cleanup -./xxx /tmp || cleanup - -echo -echo "test passed." -echo