41 lines
1.1 KiB
Bash
41 lines
1.1 KiB
Bash
#!/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
|