selinux/kernel/keycreate_empty_value/runtest.sh
Ondrej Mosnacek ef2646911d
Port kernel tests from downstream
Forward-port of downstream kernel tests that haven't been upstreamed
yet, manually converted to TMT.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-09-13 14:24:47 +02:00

37 lines
1,017 B
Bash
Executable file

#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# SPDX-License-Identifier: GPLv2
# Copyright (c) 2022 Red Hat, Inc.
# Author: Ondrej Mosnacek <omosnace@redhat.com>
# Include Beakerlib environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
EXE="reproducer"
rlJournalStart
rlPhaseStartSetup
rlRun "uname -r" 0 "Print running kernel version"
enable_container=0
if semodule -l | grep -q container; then
rlRun "semodule -d container" 0 "Disable the container module"
enable_container=1
fi
rlRun "gcc -o $EXE reproducer.c" 0 "Compile the reproducer"
rlPhaseEnd
rlPhaseStartTest
rlRun "./$EXE" 0 "Run the reproducer"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "rm -f $EXE" 0 "Remove the reproducer binary"
if [ "$enable_container" -eq 1 ]; then
rlRun "semodule -e container" 0 "Re-enable the container module"
fi
rlPhaseEnd
rlJournalPrintText
rlJournalEnd