diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..4f520a7 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +--- !Policy +product_versions: + - rhel-9 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} + - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.other.functional} diff --git a/tests/test_annobin b/tests/test_annobin new file mode 100644 index 0000000..7953dda --- /dev/null +++ b/tests/test_annobin @@ -0,0 +1,40 @@ +#!/bin/sh + +# Checks that annobin works + +. /usr/share/beakerlib/beakerlib.sh + +# Set the full test name +TEST="/AppStream/annobin/Sanity/annobin" + +# Package being tested +PACKAGE="annobin" + +rlJournalStart + # Setup phase: Prepare test directory + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun 'TmpDir=$(mktemp -d)' 0 'Creating tmp directory' # no-reboot + rlRun "pushd $TmpDir" + rlPhaseEnd + + # Test phase: Test the annobin plugin + rlPhaseStartTest + rlRun 'echo "int main (void) { return 0; }" >main.c' 0 "Create a C test source file" + rlAssertExists "main.c" + rlRun "gcc -fplugin=annobin main.c -o a.exe" 0 "Compile the test file" + rlAssertExists "a.exe" + rlRun "readelf --wide --notes a.exe >readelf.out" 0 "Examine the executable with readelf" + rlAssertExists "readelf.out" + # FIXME: Parse the output and make sure that there are is valid annobin data there + rlPhaseEnd + + # Cleanup phase: Remove test directory + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalEnd + +# Print the test report +rlJournalPrintText diff --git a/tests/test_annocheck b/tests/test_annocheck new file mode 100644 index 0000000..0296254 --- /dev/null +++ b/tests/test_annocheck @@ -0,0 +1,40 @@ +#!/bin/sh + +# Checks that annocheck works + +. /usr/share/beakerlib/beakerlib.sh + +# Set the full test name +TEST="/AppStream/annobin/Sanity/annocheck" + +# Package being tested +PACKAGE="annobin" + +rlJournalStart + # Setup phase: Prepare test directory + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun 'TmpDir=$(mktemp -d)' 0 'Creating tmp directory' # no-reboot + rlRun "pushd $TmpDir" + rlPhaseEnd + + # Test phase: Test the annobin plugin + rlPhaseStartTest + rlRun 'echo "int main (void) { return 0; }" >main.c' 0 "Create a C test source file" + rlAssertExists "main.c" + rlRun "gcc -O2 -fstack-protector-strong -fPIE -fplugin=annobin -pie -Wl,-z,now main.c -o a.exe" 0 "Compile the test file" + rlAssertExists "a.exe" + rlRun "annocheck a.exe --skip-cf-protection --skip-stack-clash --skip-glibcxx-assertions --skip-fortify --skip-warnings >annocheck.out" 0 "Examine the executable with annocheck" + rlAssertExists "annocheck.out" + # FIXME: Parse the output and make sure that the checks pass + rlPhaseEnd + + # Cleanup phase: Remove test directory + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalEnd + +# Print the test report +rlJournalPrintText diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..057e77a --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,15 @@ +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - atomic + - classic + - container + tests: + - test_annobin + - test_annocheck + required_packages: + - findutils # beakerlib needs find command + - annobin # So that we can test it... + - annobin-annocheck # We need the annocheck command + - gcc # To build some test cases