Skip to content

Commit

Permalink
file_* tests: temporary workaround for RHEL6 tempfile TEMPLATE ignore
Browse files Browse the repository at this point in the history
The RHEL6 tempfile function does not honour the TEMPLATE assignment as
coded.  This is a quick workaround example.

Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
  • Loading branch information
rgbriggs committed Dec 2, 2016
1 parent 9008525 commit 4d0fddc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion tests/file_create/test
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ my $key = key_gen();
system("auditctl -w $dir -k $key");

# create a new file in the watched directory
(my $fh, my $filename) = tempfile(TEMPLATE => $dir . "/file-XXXX", UNLINK => 1);
#(my $fh, my $filename) = tempfile(TEMPLATE => $dir . "/file-XXXX", UNLINK => 1);
my $filename = "$dir/$key";
system("touch $filename");
(my $dev, my $ino, my $mode, my $nlink, my $uid, my $gid, my $rdev, my $size,
my $atime, my $mtime, my $ctime, my $blksize, my $blocks) = stat($filename);
my $dev_fmt = sprintf("%02x:%02x", $dev >> 8, $dev & 0x00ff);
Expand Down
6 changes: 4 additions & 2 deletions tests/file_delete/test
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,18 @@ my $dir = tempdir(TEMPLATE => '/tmp/audit-testsuite-XXXX', CLEANUP => 1);
###
# tests

my $key = key_gen();
# create a test file
(my $fh, my $filename) = tempfile(TEMPLATE => $dir . "/file-XXXX", UNLINK => 1);
#(my $fh, my $filename) = tempfile(TEMPLATE => $dir . "/file-XXXX", UNLINK => 1);
my $filename = "$dir/$key";
system("touch $filename");
(my $dev, my $ino, my $mode, my $nlink, my $uid, my $gid, my $rdev, my $size,
my $atime, my $mtime, my $ctime, my $blksize, my $blocks) = stat($filename);
my $dev_fmt = sprintf("%02x:%02x", $dev >> 8, $dev & 0x00ff);
my $uid_fmt = getpwuid($uid);
my $gid_fmt = getgrgid($uid);

# set the directory watch
my $key = key_gen();
system("auditctl -w $dir -k $key");

# delete file
Expand Down
6 changes: 4 additions & 2 deletions tests/file_rename/test
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,18 @@ my $dir = tempdir(TEMPLATE => '/tmp/audit-testsuite-XXXX', CLEANUP => 1);
###
# tests

my $key = key_gen();
# create a new file in the watched directory
(my $fh, my $filename) = tempfile(TEMPLATE => $dir . "/file-XXXX", UNLINK => 1);
#(my $fh, my $filename) = tempfile(TEMPLATE => $dir . "/file-XXXX", UNLINK => 1);
my $filename = "$dir/$key";
system("touch $filename");
(my $dev, my $ino, my $mode, my $nlink, my $uid, my $gid, my $rdev, my $size,
my $atime, my $mtime, my $ctime, my $blksize, my $blocks) = stat($filename);
my $dev_fmt = sprintf("%02x:%02x", $dev >> 8, $dev & 0x00ff);
my $uid_fmt = getpwuid($uid);
my $gid_fmt = getgrgid($uid);

# set the directory watch
my $key = key_gen();
system("auditctl -w $dir -k $key");

# move/rename the file
Expand Down

0 comments on commit 4d0fddc

Please sign in to comment.