Commit 6047bca2 authored by Steve Beattie's avatar Steve Beattie

Subject: libapparmor - don't emit path in testcase output

This patch converts the C test program to only emit the basename(3) of
the test input file under consideration, rather than the entire path as
passed on the command line, and fixes up all the expected outputs to
match.

The reason to do this is to make it easier for other tools located
in other directories (e.g. under libapparmor/swig) to use these same
test cases with reduced special casing.
Signed-off-by: Steve Beattie's avatarSteve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks's avatarTyler Hicks <tyhicks@canonical.com>
parent 2c7ba249
#define _GNU_SOURCE /* for glibc's basename version */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -21,7 +23,7 @@ int main(int argc, char **argv)
}
printf("START\n");
printf("File: %s\n", argv[1]);
printf("File: %s\n", basename(argv[1]));
testcase = fopen(argv[1], "r");
if (testcase == NULL)
......
START
File: test_multi/avc_audit_01.in
File: avc_audit_01.in
Event type: AA_RECORD_DENIED
Audit ID: 1279948288.415:39
Operation: open
......
START
File: test_multi/avc_audit_02.in
File: avc_audit_02.in
Event type: AA_RECORD_STATUS
Audit ID: 1279948227.175:27
Operation: profile_replace
......
START
File: test_multi/avc_audit_03.in
File: avc_audit_03.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1279968846.035:77
Operation: open
......
START
File: test_multi/avc_audit_invalid_audit_id.in
File: avc_audit_invalid_audit_id.in
Event type: AA_RECORD_INVALID
START
File: test_multi/avc_syslog_01.in
File: avc_syslog_01.in
Event type: AA_RECORD_DENIED
Audit ID: 1279967133.365:54
Operation: open
......
START
File: test_multi/avc_syslog_02.in
File: avc_syslog_02.in
Event type: AA_RECORD_STATUS
Audit ID: 1279967081.455:42
Operation: profile_replace
......
START
File: test_multi/avc_syslog_03.in
File: avc_syslog_03.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1279968846.035:77
Operation: open
......
START
File: test_multi/old_style_log_01.in
File: old_style_log_01.in
Event type: AA_RECORD_INVALID
Audit ID: 1157215966.604:46
Operation: APPARMOR
......
START
File: test_multi/old_style_log_02.in
File: old_style_log_02.in
Event type: AA_RECORD_INVALID
Audit ID: 1167188680.127:54
Info: REJECTING r access to /bin/freak-aa-out (bash(23415) profile /bin/freak-aa-out active /bin/freak-aa-out)
......
START
File: test_multi/old_style_log_03.in
File: old_style_log_03.in
Event type: AA_RECORD_INVALID
Audit ID: 1173790298.651:1662
Operation: APPARMOR
......
START
File: test_multi/old_style_log_04.in
File: old_style_log_04.in
Event type: AA_RECORD_INVALID
Audit ID: 1177962395.525:1837
Operation: APPARMOR
......
START
File: test_multi/old_style_log_05.in
File: old_style_log_05.in
Event type: AA_RECORD_INVALID
Audit ID: 1167188680.127:54
Operation: APPARMOR
......
START
File: test_multi/old_style_log_06.in
File: old_style_log_06.in
Event type: AA_RECORD_INVALID
Audit ID: 1167188680.127:54
Operation: APPARMOR
......
START
File: test_multi/old_style_log_07.in
File: old_style_log_07.in
Event type: AA_RECORD_INVALID
Audit ID: 1167188680.127:54
Operation: APPARMOR
......
START
File: test_multi/old_style_log_08.in
File: old_style_log_08.in
Event type: AA_RECORD_INVALID
Audit ID: 1168662182.495:58
Operation: APPARMOR
......
START
File: test_multi/old_style_log_09.in
File: old_style_log_09.in
Event type: AA_RECORD_INVALID
Audit ID: 1167188680.127:54
Operation: APPARMOR
......
START
File: test_multi/old_style_log_10.in
File: old_style_log_10.in
Event type: AA_RECORD_INVALID
Audit ID: 1167188680.127:54
Operation: APPARMOR
......
START
File: test_multi/old_style_log_11.in
File: old_style_log_11.in
Event type: AA_RECORD_INVALID
Audit ID: 1167188680.127:54
Operation: APPARMOR
......
START
File: test_multi/old_style_log_12.in
File: old_style_log_12.in
Event type: AA_RECORD_INVALID
Audit ID: 1201615421.935:4837
Operation: APPARMOR
......
START
File: test_multi/old_style_log_13.in
File: old_style_log_13.in
Event type: AA_RECORD_INVALID
Audit ID: 1173790298.983:1669
Operation: APPARMOR
......
START
File: test_multi/old_style_log_14.in
File: old_style_log_14.in
Event type: AA_RECORD_INVALID
Audit ID: 1177962426.395:2107
Operation: APPARMOR
......
START
File: test_multi/old_style_log_15.in
File: old_style_log_15.in
Event type: AA_RECORD_INVALID
Audit ID: 1168661976.062:55
Operation: APPARMOR
......
START
File: test_multi/old_style_log_16.in
File: old_style_log_16.in
Event type: AA_RECORD_INVALID
Audit ID: 1168661976.062:55
Operation: APPARMOR
......
START
File: test_multi/old_style_log_17.in
File: old_style_log_17.in
Event type: AA_RECORD_INVALID
Audit ID: 1164007073.953:518
Operation: APPARMOR
......
START
File: test_multi/old_style_log_18.in
File: old_style_log_18.in
Event type: AA_RECORD_INVALID
Audit ID: 1168661976.062:55
Operation: APPARMOR
......
START
File: test_multi/syslog_audit_05.in
File: syslog_audit_05.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1225263601.980:37699
Operation: inode_permission
......
START
File: test_multi/syslog_audit_06.in
File: syslog_audit_06.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1225263601.980:37699
Operation: inode_permission
......
START
File: test_multi/syslog_datetime_01.in
File: syslog_datetime_01.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_02.in
File: syslog_datetime_02.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_03.in
File: syslog_datetime_03.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_04.in
File: syslog_datetime_04.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_05.in
File: syslog_datetime_05.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_06.in
File: syslog_datetime_06.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_07.in
File: syslog_datetime_07.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_08.in
File: syslog_datetime_08.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_09.in
File: syslog_datetime_09.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_10.in
File: syslog_datetime_10.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_11.in
File: syslog_datetime_11.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_12.in
File: syslog_datetime_12.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_13.in
File: syslog_datetime_13.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_14.in
File: syslog_datetime_14.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_15.in
File: syslog_datetime_15.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_16.in
File: syslog_datetime_16.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_17.in
File: syslog_datetime_17.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_datetime_18.in
File: syslog_datetime_18.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1357024144.556:6368
Operation: open
......
START
File: test_multi/syslog_other_01.in
File: syslog_other_01.in
Event type: AA_RECORD_INVALID
START
File: test_multi/syslog_other_02.in
File: syslog_other_02.in
Event type: AA_RECORD_INVALID
START
File: test_multi/syslog_other_03.in
File: syslog_other_03.in
Event type: AA_RECORD_INVALID
START
File: test_multi/syslog_other_04.in
File: syslog_other_04.in
Event type: AA_RECORD_INVALID
START
File: test_multi/testcase01.in
File: testcase01.in
Event type: AA_RECORD_DENIED
Audit ID: 1181057184.959:7
Operation: exec
......
START
File: test_multi/testcase02.in
File: testcase02.in
Event type: AA_RECORD_DENIED
Audit ID: 1236891550.807:870
Operation: capable
......
START
File: test_multi/testcase03.in
File: testcase03.in
Event type: AA_RECORD_DENIED
Audit ID: 1236891550.807:870
Operation: capable
......
START
File: test_multi/testcase04.in
File: testcase04.in
Event type: AA_RECORD_DENIED
Audit ID: 1236891550.807:870
Operation: capable
......
START
File: test_multi/testcase05.in
File: testcase05.in
Event type: AA_RECORD_DENIED
Audit ID: 1236891550.807:870
Operation: capable
......
START
File: test_multi/testcase06.in
File: testcase06.in
Event type: AA_RECORD_DENIED
Audit ID: 1236891550.807:870
Operation: capable
......
START
File: test_multi/testcase07.in
File: testcase07.in
Event type: AA_RECORD_DENIED
Audit ID: 1236891550.807:870
Operation: capable
......
START
File: test_multi/testcase08.in
File: testcase08.in
Event type: AA_RECORD_DENIED
Audit ID: 1236891550.807:870
Operation: capable
......
START
File: test_multi/testcase09.in
File: testcase09.in
Event type: AA_RECORD_DENIED
Audit ID: 1236891550.807:870
Operation: capable
......
START
File: test_multi/testcase10.in
File: testcase10.in
Event type: AA_RECORD_DENIED
Audit ID: 1236891550.807:870
Operation: capable
......
START
File: test_multi/testcase11.in
File: testcase11.in
Event type: AA_RECORD_DENIED
Audit ID: 1236891550.807:870
Operation: capable
......
START
File: test_multi/testcase12.in
File: testcase12.in
Event type: AA_RECORD_DENIED
Audit ID: 1181057184.959:7
Operation: exec
......
START
File: test_multi/testcase13.in
File: testcase13.in
Event type: AA_RECORD_DENIED
Audit ID: 1181057184.959:7
Operation: exec
......
START
File: test_multi/testcase14.in
File: testcase14.in
Event type: AA_RECORD_DENIED
Audit ID: 1189201672.746:537
Operation: file_lock
......
START
File: test_multi/testcase15.in
File: testcase15.in
Event type: AA_RECORD_DENIED
Audit ID: 1189201672.746:537
Operation: file_lock
......
START
File: test_multi/testcase16.in
File: testcase16.in
Event type: AA_RECORD_DENIED
Audit ID: 1189201672.746:537
Operation: file_lock
......
START
File: test_multi/testcase17.in
File: testcase17.in
Event type: AA_RECORD_DENIED
Audit ID: 1189201672.746:537
Operation: file_lock
......
START
File: test_multi/testcase18.in
File: testcase18.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1236774787.169:369
Operation: inode_permission
......
START
File: test_multi/testcase19.in
File: testcase19.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1236774787.169:371
Operation: file_mmap
......
START
File: test_multi/testcase21.in
File: testcase21.in
Event type: AA_RECORD_DENIED
Audit ID: 1190305330.060:14638
Operation: inode_permission
......
START
File: test_multi/testcase22.in
File: testcase22.in
Event type: AA_RECORD_DENIED
Audit ID: 1190305421.066:14665
Operation: inode_permission
......
START
File: test_multi/testcase24.in
File: testcase24.in
Event type: AA_RECORD_DENIED
Audit ID: 1190503205.837:27088
Operation: socket_create
......
START
File: test_multi/testcase25.in
File: testcase25.in
Event type: AA_RECORD_HINT
Audit ID: 1190503291.842:27382
Operation: clone
......
START
File: test_multi/testcase26.in
File: testcase26.in
Event type: AA_RECORD_HINT
Audit ID: 1188599886.852:8780
Operation: ptrace
......
START
File: test_multi/testcase31.in
File: testcase31.in
Event type: AA_RECORD_DENIED
Audit ID: 1190503664.863:27763
Operation: inode_link
......
START
File: test_multi/testcase32.in
File: testcase32.in
Event type: AA_RECORD_INVALID
Audit ID: 1190410201.037:20926
Operation: CRED_ACQ
......
START
File: test_multi/testcase33.in
File: testcase33.in
Event type: AA_RECORD_DENIED
Audit ID: 1190503205.837:27088
Operation: socket_create
......
START
File: test_multi/testcase35.in
File: testcase35.in
Event type: AA_RECORD_AUDIT
Audit ID: 1205249275.686:289
Operation: file_lock
......
START
File: test_multi/testcase_dbus_01.in
File: testcase_dbus_01.in
Event type: AA_RECORD_DENIED
Operation: dbus_method_call
Denied Mask: send
......
START
File: test_multi/testcase_dbus_02.in
File: testcase_dbus_02.in
Event type: AA_RECORD_DENIED
Operation: dbus_bind
Denied Mask: bind
......
START
File: test_multi/testcase_dbus_03.in
File: testcase_dbus_03.in
Event type: AA_RECORD_DENIED
Operation: dbus_signal
Denied Mask: receive
......
START
File: test_multi/testcase_dbus_04.in
File: testcase_dbus_04.in
Event type: AA_RECORD_DENIED
Audit ID: 1375323372.644:157
Operation: dbus_method_call
......
START
File: test_multi/testcase_dbus_05.in
File: testcase_dbus_05.in
Event type: AA_RECORD_DENIED
Audit ID: 1375323416.656:167
Operation: dbus_bind
......
START
File: test_multi/testcase_dbus_06.in
File: testcase_dbus_06.in
Event type: AA_RECORD_DENIED
Audit ID: 1375323488.608:182
Operation: dbus_signal
......
START
File: test_multi/testcase_encoded_comm.in
File: testcase_encoded_comm.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1322676143.201:455
Operation: open
......
START
File: test_multi/testcase_encoded_profile.in
File: testcase_encoded_profile.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1322614912.304:857
Operation: getattr
......
START
File: test_multi/testcase_network_01.in
File: testcase_network_01.in
Event type: AA_RECORD_DENIED
Audit ID: 1308766940.698:3704
Operation: sendmsg
......
START
File: test_multi/testcase_network_02.in
File: testcase_network_02.in
Event type: AA_RECORD_DENIED
Audit ID: 1308766940.698:3704
Operation: sendmsg
......
START
File: test_multi/testcase_network_03.in
File: testcase_network_03.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1333648169.009:11707146
Operation: accept
......
START
File: test_multi/testcase_network_04.in
File: testcase_network_04.in
Event type: AA_RECORD_DENIED
Audit ID: 1333697181.284:273901
Operation: recvmsg
......
START
File: test_multi/testcase_network_05.in
File: testcase_network_05.in
Event type: AA_RECORD_DENIED
Audit ID: 1333698107.128:273917