From b6275050b0fa34fb0f76b242ae417691ea83bb94 Mon Sep 17 00:00:00 2001
From: Benedikt Morbach <benedikt.morbach@googlemail.com>
Date: Thu, 21 Aug 2014 15:02:57 +0200
Subject: [PATCH] use host-prefixed ar in archive test
Organization: Exherbo

---
 configure.ac                                     |  3 ++-
 tests/scripts/features/{archives => archives.in} | 26 ++++++++++++------------
 tests/test_driver.pl                             |  2 +-
 3 files changed, 16 insertions(+), 15 deletions(-)
 rename tests/scripts/features/{archives => archives.in} (76%)

diff --git a/configure.ac b/configure.ac
index ad07a7e..c1ec196 100644
--- a/configure.ac
+++ b/configure.ac
@@ -503,7 +503,8 @@ AS_IF([test "x$make_cv_load" = xno && test "x$user_load" = xyes],
 
 # Specify what files are to be created.
 AC_CONFIG_FILES([Makefile glob/Makefile po/Makefile.in config/Makefile \
-                 doc/Makefile w32/Makefile tests/config-flags.pm])
+                 doc/Makefile w32/Makefile tests/config-flags.pm \
+                 tests/scripts/features/archives])
 
 # OK, do it!
 
diff --git a/tests/scripts/features/archives b/tests/scripts/features/archives.in
similarity index 76%
rename from tests/scripts/features/archives
rename to tests/scripts/features/archives.in
index a7ec881..518bce5 100644
--- a/tests/scripts/features/archives
+++ b/tests/scripts/features/archives.in
@@ -12,31 +12,31 @@ exists $FEATURES{archives} or return -1;
 utouch(-60, qw(a1.o a2.o a3.o));
 
 # Some versions of ar print different things on creation.  Find out.
-my $created = `ar rv libxx.a a1.o 2>&1`;
+my $created = `@AR@ rv libxx.a a1.o 2>&1`;
 
 # Some versions of ar print different things on add.  Find out.
-my $add = `ar rv libxx.a a2.o 2>&1`;
+my $add = `@AR@ rv libxx.a a2.o 2>&1`;
 $add =~ s/a2\.o/#OBJECT#/g;
 
 # Some versions of ar print different things on replacement.  Find out.
-my $repl = `ar rv libxx.a a2.o 2>&1`;
+my $repl = `@AR@ rv libxx.a a2.o 2>&1`;
 $repl =~ s/a2\.o/#OBJECT#/g;
 
 unlink('libxx.a');
 
 # Very simple
 run_make_test('all: libxx.a(a1.o)',
-              '', "ar rv libxx.a a1.o\n$created");
+              'AR=@AR@', "@AR@ rv libxx.a a1.o\n$created");
 
 # Multiple .o's.  Add a new one to the existing library
 ($_ = $add) =~ s/#OBJECT#/a2.o/g;
 run_make_test('all: libxx.a(a1.o a2.o)',
-              '', "ar rv libxx.a a2.o\n$_");
+              'AR=@AR@', "@AR@ rv libxx.a a2.o\n$_");
 
 # Touch one of the .o's so it's rebuilt
 utouch(-40, 'a1.o');
 ($_ = $repl) =~ s/#OBJECT#/a1.o/g;
-run_make_test(undef, '', "ar rv libxx.a a1.o\n$_");
+run_make_test(undef, 'AR=@AR@', "@AR@ rv libxx.a a1.o\n$_");
 
 # Use wildcards
 run_make_test('all: libxx.a(*.o)',
@@ -45,21 +45,21 @@ run_make_test('all: libxx.a(*.o)',
 # Touch one of the .o's so it's rebuilt
 utouch(-30, 'a1.o');
 ($_ = $repl) =~ s/#OBJECT#/a1.o/g;
-run_make_test(undef, '', "ar rv libxx.a a1.o\n$_");
+run_make_test(undef, 'AR=@AR@', "@AR@ rv libxx.a a1.o\n$_");
 
 # Use both wildcards and simple names
 utouch(-50, 'a2.o');
 ($_ = $add) =~ s/#OBJECT#/a3.o/g;
-$_ .= "ar rv libxx.a a2.o\n";
+$_ .= "@AR@ rv libxx.a a2.o\n";
 ($_ .= $repl) =~ s/#OBJECT#/a2.o/g;
-run_make_test('all: libxx.a(a3.o *.o)', '',
-              "ar rv libxx.a a3.o\n$_");
+run_make_test('all: libxx.a(a3.o *.o)', 'AR=@AR@',
+              "@AR@ rv libxx.a a3.o\n$_");
 
 # Check whitespace handling
 utouch(-40, 'a2.o');
 ($_ = $repl) =~ s/#OBJECT#/a2.o/g;
-run_make_test('all: libxx.a(  a3.o    *.o     )', '',
-              "ar rv libxx.a a2.o\n$_");
+run_make_test('all: libxx.a(  a3.o    *.o     )', 'AR=@AR@',
+              "@AR@ rv libxx.a a2.o\n$_");
 
 rmfiles(qw(a1.o a2.o a3.o libxx.a));
 
@@ -84,7 +84,7 @@ default: lib(foo)
 (%): %.vhd ; @cd $(DIR) && touch $(*F) && $(AR) $(ARFLAGS) $@ $(*F) >/dev/null 2>&1 && rm $(*F)
 .PHONY: default
 !,
-              '', "");
+              'AR=@AR@', "");
 
 run_make_test(undef, '', "#MAKE#: Nothing to be done for 'default'.\n");
 
diff --git a/tests/test_driver.pl b/tests/test_driver.pl
index 68982f4..3109c28 100644
--- a/tests/test_driver.pl
+++ b/tests/test_driver.pl
@@ -254,7 +254,7 @@ sub toplevel
           || &error ("Couldn't mkdir $workpath/$dir: $!\n");
       opendir (SCRIPTDIR, "$scriptpath/$dir")
           || &error ("Couldn't opendir $scriptpath/$dir: $!\n");
-      @files = grep (!/^(\..*|CVS|RCS|.*~)$/, readdir (SCRIPTDIR) );
+      @files = grep (!/^(\..*|CVS|RCS|.*~|.*\.in)$/, readdir (SCRIPTDIR) );
       closedir (SCRIPTDIR);
       foreach $test (@files)
       {
-- 
2.0.4

