From 1b41f513fa11fe54505b713a61ed9b020e6ca0d5 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 27 Aug 2008 15:56:37 +0000 Subject: [PATCH] Fix generation of .t files on Windows. --- configure/RULES_BUILD | 5 ++--- src/tools/Makefile | 1 + src/tools/makeTestfile.pl | 31 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 src/tools/makeTestfile.pl diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 092142c63..448956672 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -334,11 +334,10 @@ runtests: $(TESTSCRIPTS_$(BUILD_CLASS)) @$(CP) $< $@ # Some versions of Test::Harness expect test programs in perl only. -# Generate a 1-line perl program to exec the real test binary. -# Uses the $0 runtime path to itself to find the executable. +# Generate a perl program to exec the real test binary. %.t: %$(EXE) @$(RM) $@ - @echo '($$e=$$0)=~s/.t$$/$(EXE)/;exec "./$$e" or die "exec failed";'>$@ + @$(PERL) $(TOOLS)/makeTestfile.pl $@ $< #--------------------------------------------------------------- ## Install rules for BIN_INSTALLS and LIB_INSTALLS diff --git a/src/tools/Makefile b/src/tools/Makefile index 6733dc820..e24c51687 100644 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -33,6 +33,7 @@ PERL_SCRIPTS += installEpics.pl PERL_SCRIPTS += makeDbDepends.pl PERL_SCRIPTS += makeIncludeDbd.pl PERL_SCRIPTS += makeMakefile.pl +PERL_SCRIPTS += makeTestfile.pl PERL_SCRIPTS += mkmf.pl PERL_SCRIPTS += munch.pl PERL_SCRIPTS += replaceVAR.pl diff --git a/src/tools/makeTestfile.pl b/src/tools/makeTestfile.pl new file mode 100644 index 000000000..3ecfd2b91 --- /dev/null +++ b/src/tools/makeTestfile.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl +#************************************************************************* +# Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# Copyright (c) 2002 The Regents of the University of California, as +# Operator of Los Alamos National Laboratory. +# EPICS BASE is distributed subject to a Software License Agreement found +# in file LICENSE that is included with this distribution. +#************************************************************************* + +# The makeTestfile.pl script generates a file $target.t which is needed +# because some versions of the Perl test harness can only run test scripts +# that are actually written in Perl. The script we generate execs the +# real test program which must be in the same directory as the .t file. + +# Usage: makeTestfile.pl target.t executable +# target.t is the name of the Perl script to generate +# executable is the name of the file the script runs + +use strict; + +my ($target, $exe) = @ARGV; + +open(my $OUT, '>', $target) or die "Can't create $target: $!\n"; + +print $OUT <