]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: Make check-file-access.pl accept files through argv
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 4 Dec 2019 13:58:04 +0000 (14:58 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 4 Dec 2019 14:43:09 +0000 (15:43 +0100)
The script needs two files to open:

  $(builddir)/test_file_access.txt, and
  $(srcdir)/file_access_whitelist.txt.

However, the script is opening the files from the $CWD which
won't work for a VPATH build. Make the script accept paths to the
files through @ARGV and tune the Makefile.am to pass them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
tests/Makefile.am
tests/check-file-access.pl

index cbe8e8622411ea95e23773acb7cc31a1148ce017..4c2856bf972fa9485e70d864929b3c76bc6ce2fb 100644 (file)
@@ -454,7 +454,9 @@ EXTRA_DIST += $(test_scripts)
 if WITH_LINUX
 check-access: file-access-clean
        VIR_TEST_FILE_ACCESS=1 $(MAKE) $(AM_MAKEFLAGS) check
-       $(PERL) check-file-access.pl | sort -u
+       $(PERL) $(abs_srcdir)/check-file-access.pl \
+               $(abs_builddir)/test_file_access.txt \
+               $(abs_srcdir)/file_access_whitelist.txt | sort -u
 
 file-access-clean:
        > test_file_access.txt
index ea0b7a18a27c2402b43ed6923a0d05b99753c4a2..2926126b14c1e714bd14f73690ebd8b4d8385aa0 100755 (executable)
 use strict;
 use warnings;
 
-my $access_file = "test_file_access.txt";
-my $whitelist_file = "file_access_whitelist.txt";
+sub usage {
+    die "$0 access_file file_access_whitelist\n";
+}
+
+my $access_file = shift or usage();
+my $whitelist_file = shift or usage();
 
 my @known_actions = ("open", "fopen", "access", "stat", "lstat", "connect");