Debian Codegraph @

tests/probes/rpm/rpmverifypackage/test_probes_rpmverifypackage.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2
3 # Copyright 2015-2019 Red Hat Inc., Durham, North Carolina.
4 # All Rights Reserved.
5 #
6 # OpenSCAP Probes Test Suite.
7 # Tests the rpmverifypackage probe.
8 #
9 # Authors:
10 # Jan Černý <[email protected]>
11 # Evgenii Kolesnikov <[email protected]>
12
13 . $builddir/tests/test_common.sh
14 . $srcdir/rpmverifypackage_common.sh
15
16 set -e -o pipefail
17 set -x
18
19 [scip-shell system . . `[`. -f /etc/os-releasescip-shell filesystem . . `/etc/os-release`. ] && . /etc/os-releasescip-shell source . . `/etc/os-release`.
20
21
22 function test_probes_rpmverifypackage_epochscip-shell shell shell-project 0.0.0 test_probes_rpmverifypackage_epoch(). {
23 RPM_package_1=$(rpm -qa --qf "%{NAME}\t%{EPOCH}\n" | grepscip-shell system . . grep. -v "(none)" | sortscip-shell system . . sort. -u | headscip-shell system . . head. -1 | cutscip-shell system . . cut. -f 1) || ret=$?
24 test_probes_rpmverifypackage $RPM_package_1
25 }
26
27 function test_probes_rpmverifypackage_noepochscip-shell shell shell-project 0.0.0 test_probes_rpmverifypackage_noepoch(). {
28 RPM_package_2=$(rpm -qa --qf "%{NAME}\t%{EPOCH}\n" | grepscip-shell system . . grep. "(none)" | sortscip-shell system . . sort. -u | headscip-shell system . . head. -1 | cutscip-shell system . . cut. -f 1) || ret=$?
29 test_probes_rpmverifypackage $RPM_package_2
30 }
31
32 function test_probes_rpmverifypackage_rpmscip-shell shell shell-project 0.0.0 test_probes_rpmverifypackage_rpm(). {
33 test_probes_rpmverifypackage rpm
34 }
35
36
37 test_init
38
39 if [[ $ID != *"sle"* && $ID != *"suse"* ]]; then
40 test_run "rpmverifypackage probe test with epoch" test_probes_rpmverifypackage_epoch
41 else
42 test_run "rpmverifypackage probe test" test_probes_rpmverifypackage_noepoch
43 fi
44
45 test_exit