acl/0012-test-make-running-parallel-out-of-tree-safe.patch
Marcus Meissner 5439477a49 Accepting request 347209 from home:jeff_mahoney:branches:Base:System
- Update to git snapshot dated 21 Sep 2015.
  - Added:
    * 0001-Install-the-libraries-to-the-appropriate-directory.patch
    * 0002-setfacl.1-fix-typo-inclu-de-include.patch
    * 0003-test-fix-insufficient-quoting-of.patch
    * 0004-Makefile-rename-configure.in-to-configure.ac.patch
    * 0005-Bad-markup-in-acl.5-page.patch
    * 0006-.gitignore-ignore-and-config.h.in.patch
    * 0007-Use-autoreconf-rather-than-autoconf-to-regenerate-th.patch
    * 0008-libacl-Make-sure-that-acl_from_text-always-sets-errn.patch
    * 0009-libacl-fix-SIGSEGV-of-getfacl-e-on-overly-long-group.patch
    * 0010-punt-debian-rpm-packaging-logic.patch
    * 0011-move-gettext-logic-into-misc.h.patch
    * 0012-test-make-running-parallel-out-of-tree-safe.patch
    * 0013-modernize-build-system.patch
    * 0014-po-regenerate-files-after-move.patch
    * 0015-build-drop-aclincludedir-use-pkgincludedir.patch
    * 0016-build-make-use-of-an-aux-dir-to-stow-away-helper-scr.patch
    * 0017-build-ship-a-pkgconfig-file-for-libacl.patch
    * 0018-read_acl_-comments-seq-rename-line-to-lineno.patch
    * 0019-read_acl_-comments-seq-switch-to-next_line.patch
    * 0020-telldir-return-value-and-seekdir-second-parameters-a.patch
    * 0021-mark-libmisc-funcs-as-hidden-so-they-are-not-exporte.patch
    * 0022-add-__acl_-prefixes-to-internal-symbols.patch
    * 0023-cp.test-Check-permissions-of-the-right-file.patch
    * 0024-libacl-acl_set_file-Remove-unnecesary-racy-check.patch
    * 0025-fix-compilation-with-latest-xattr-git.patch
    * 0026-getfacl-Fix-memory-leak.patch
    * 0027-Fix-the-display-block-nesting-in-acl.5.patch
    * 0028-setfacl-man-page-Minor-wording-improvements.patch

OBS-URL: https://build.opensuse.org/request/show/347209
OBS-URL: https://build.opensuse.org/package/show/Base:System/acl?expand=0&rev=43
2015-12-03 14:58:36 +00:00

158 lines
4.4 KiB
Diff

From 2d13383b7fbcc04fc16681caa4f43d9d9083cca1 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Fri, 10 Jan 2014 10:07:40 -0500
Subject: [PATCH 12/34] test: make running parallel/out-of-tree safe
Change the run program to update PATH to find the tools locally
automatically. This lets us avoid having to always build in the
tree and allows for direct running.
Also update the program to create a tempdir for each test to run
inside of. This way we can run all the tests in parallel without
randomly clobbering each other.
---
test/getfacl-recursive.test | 12 ++++++------
test/malformed-restore.test | 2 +-
test/run | 29 ++++++++++++++++++++++++++++-
3 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/test/getfacl-recursive.test b/test/getfacl-recursive.test
index a72192e..8f5dd4e 100644
--- a/test/getfacl-recursive.test
+++ b/test/getfacl-recursive.test
@@ -5,7 +5,7 @@ Tests for proper path recursion
$ mkdir 1/link
$ touch 1/link/file
$ ln -s `pwd`/1/link 1/2/link
- $ getfacl -P -R 1/2 | ./sort-getfacl-output
+ $ getfacl -P -R 1/2 | sort-getfacl-output
> # file: 1/2
> # owner: %TUSER
> # group: %TGROUP
@@ -21,7 +21,7 @@ Tests for proper path recursion
> other::r-x
>
- $ getfacl -R 1/2 | ./sort-getfacl-output
+ $ getfacl -R 1/2 | sort-getfacl-output
> # file: 1/2
> # owner: %TUSER
> # group: %TGROUP
@@ -37,7 +37,7 @@ Tests for proper path recursion
> other::r-x
>
- $ getfacl -R -L 1/2 | ./sort-getfacl-output
+ $ getfacl -R -L 1/2 | sort-getfacl-output
> # file: 1/2
> # owner: %TUSER
> # group: %TGROUP
@@ -67,7 +67,7 @@ Tests for proper path recursion
> other::r--
>
- $ getfacl -P -R 1 | ./sort-getfacl-output
+ $ getfacl -P -R 1 | sort-getfacl-output
> # file: 1
> # owner: %TUSER
> # group: %TGROUP
@@ -104,7 +104,7 @@ Tests for proper path recursion
> other::r--
>
- $ getfacl -R 1 | ./sort-getfacl-output
+ $ getfacl -R 1 | sort-getfacl-output
> # file: 1
> # owner: %TUSER
> # group: %TGROUP
@@ -141,7 +141,7 @@ Tests for proper path recursion
> other::r--
>
- $ getfacl -R -L 1 | ./sort-getfacl-output
+ $ getfacl -R -L 1 | sort-getfacl-output
> # file: 1
> # owner: %TUSER
> # group: %TGROUP
diff --git a/test/malformed-restore.test b/test/malformed-restore.test
index e92b75b..5e5391c 100644
--- a/test/malformed-restore.test
+++ b/test/malformed-restore.test
@@ -1,7 +1,7 @@
Test for malformed input to --restore
https://savannah.nongnu.org/bugs/index.php?28185
- $ cp malformed-restore-double-owner.acl tmp.acl
+ $ cp "%TESTDIR/malformed-restore-double-owner.acl" tmp.acl
$ sed -i "s/USER/%TUSER/g" tmp.acl
$ sed -i "s/GROUP/%TGROUP/g" tmp.acl
$ touch tmp
diff --git a/test/run b/test/run
index 2cf52e8..0a12be6 100755
--- a/test/run
+++ b/test/run
@@ -37,7 +37,10 @@
#
use strict;
+use Cwd qw(abs_path);
use FileHandle;
+use File::Basename qw(basename dirname);
+use File::Path qw(rmtree);
use Getopt::Std;
use POSIX qw(isatty setuid getcwd);
use vars qw($opt_l $opt_v);
@@ -53,9 +56,28 @@ if (isatty(fileno(STDOUT))) {
$FAILED = "\033[31m\033[1m" . $FAILED . "\033[m";
}
+# Export this dir to tests so they can access data files if needed.
+$ENV{"TESTDIR"} = abs_path(dirname($0));
+# Add the current dir to PATH so we can find sort-getfattr-output and such.
+$ENV{"PATH"} = $ENV{"TESTDIR"} . ":$ENV{PATH}";
+# Add the parent dir to PATH so we can find the compiled tools.
+$ENV{"PATH"} = dirname(abs_path(dirname($0))) . ":$ENV{PATH}";
$ENV{"TUSER"} = getpwuid($>);
$ENV{"TGROUP"} = getgrgid($));
+open(TEST_FILE, $ARGV[0]);
+
+# Create a tempdir to run in for parallel test execution.
+my $tmpdir = $ARGV[0] . ".dir";
+rmtree($tmpdir);
+if (!mkdir($tmpdir)) {
+ $tmpdir = getcwd() . "/" . basename($ARGV[0]) . ".dir";
+ rmtree($tmpdir);
+ mkdir($tmpdir) or die "could not create $tmpdir";
+}
+my $pretmpdir = getcwd();
+chdir($tmpdir) or die "could not enter $tmpdir";
+
sub exec_test($$);
sub process_test($$$$);
@@ -66,7 +88,7 @@ my $lineno;
my $width = ($ENV{COLUMNS} || 80) >> 1;
for (;;) {
- my $line = <>; $lineno++;
+ my $line = <TEST_FILE>; $lineno++;
if (defined $line) {
# Substitute %VAR and %{VAR} with environment variables.
$line =~ s[%(\w+)][$ENV{$1}]eg;
@@ -106,6 +128,11 @@ if (isatty(fileno(STDOUT))) {
}
}
print $status, "\n";
+
+# Now clean up the testdir.
+chdir($pretmpdir);
+rmtree($tmpdir);
+
exit $failed ? 1 : 0;
--
2.5.2