Merge branch 'rtems-test' into 3.16
This commit is contained in:
@@ -51,6 +51,7 @@ PERL_SCRIPTS += mkmf.pl
|
||||
PERL_SCRIPTS += munch.pl
|
||||
PERL_SCRIPTS += replaceVAR.pl
|
||||
PERL_SCRIPTS += tap-to-junit-xml.pl
|
||||
PERL_SCRIPTS += epicsMakeMemFs.pl
|
||||
PERL_SCRIPTS += useManifestTool.pl
|
||||
PERL_SCRIPTS += genVersionHeader.pl
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
|
||||
use File::Basename;
|
||||
|
||||
use strict;
|
||||
|
||||
my $outfile = shift;
|
||||
my $varname = shift;
|
||||
|
||||
open(my $DST, '>', $outfile) or die "Failed to open $outfile";
|
||||
|
||||
print $DST <<EOF;
|
||||
#include <epicsMemFs.h>
|
||||
EOF
|
||||
|
||||
my $N = 0;
|
||||
|
||||
for my $fname (@ARGV) {
|
||||
print "<- $fname\n";
|
||||
my $realfname = $fname;
|
||||
|
||||
# strip leading "../" "./" or "/"
|
||||
while ($fname =~ /^\.*\/(.*)$/) { $fname = $1; }
|
||||
|
||||
my $file = basename($fname);
|
||||
my @dirs = split('/', dirname($fname));
|
||||
|
||||
print $DST "/* begin $realfname */\nstatic const char * const file_${N}_dir[] = {";
|
||||
for my $dpart (@dirs) {
|
||||
print $DST "\"$dpart\", ";
|
||||
}
|
||||
print $DST "NULL};\nstatic const char file_${N}_data[] = {\n ";
|
||||
|
||||
open(my $SRC, '<', $realfname) or die "Failed to open $realfname";
|
||||
binmode($SRC);
|
||||
|
||||
my $buf;
|
||||
my $total = 0;
|
||||
while (my $num = read($SRC, $buf, 32)) {
|
||||
if($total != 0) {
|
||||
print $DST ",\n ";
|
||||
}
|
||||
$total += $num;
|
||||
my $out = join(",",map(ord,split(//,$buf)));
|
||||
print $DST "$out";
|
||||
}
|
||||
|
||||
close($SRC);
|
||||
|
||||
print $DST <<EOF;
|
||||
|
||||
};
|
||||
static const epicsMemFile file_${N} = {
|
||||
file_${N}_dir,
|
||||
\"$file\",
|
||||
file_${N}_data,
|
||||
$total
|
||||
};
|
||||
/* end $realfname */
|
||||
EOF
|
||||
$N = $N + 1;
|
||||
}
|
||||
|
||||
print $DST <<EOF;
|
||||
static const epicsMemFile* files[] = {
|
||||
EOF
|
||||
|
||||
$N = $N - 1;
|
||||
|
||||
for my $i (0..${N}) {
|
||||
print $DST " &file_${i},";
|
||||
}
|
||||
|
||||
print $DST <<EOF;
|
||||
NULL
|
||||
};
|
||||
static
|
||||
const epicsMemFS ${varname}_image = {&files[0]};
|
||||
const epicsMemFS * $varname = &${varname}_image;
|
||||
EOF
|
||||
|
||||
close($DST);
|
||||
+29
-11
@@ -15,18 +15,43 @@
|
||||
# If the script is given an argument -tap it sets HARNESS_ACTIVE in the
|
||||
# environment to make the epicsUnitTest code generate strict TAP output.
|
||||
|
||||
# Usage: makeTestfile.pl target.t executable
|
||||
# Usage: makeTestfile.pl <target-arch> <host-arch> target.t executable
|
||||
# target-arch and host-arch are EPICS build target names (eg. linux-x86)
|
||||
# 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;
|
||||
my ($TA, $HA, $target, $exe) = @ARGV;
|
||||
my $exec;
|
||||
|
||||
# Use WINE to run windows target executables on non-windows host
|
||||
if( $TA =~ /^win32-x86/ && $HA !~ /^win/ ) {
|
||||
# new deb. derivatives have wine32 and wine64
|
||||
# older have wine and wine64
|
||||
# prefer wine32 if present
|
||||
my $wine32 = "/usr/bin/wine32";
|
||||
$wine32 = "/usr/bin/wine" if ! -x $wine32;
|
||||
$exec = "$wine32 $exe";
|
||||
} elsif( $TA =~ /^windows-x64/ && $HA !~ /^win/ ) {
|
||||
$exec = "wine64 $exe";
|
||||
|
||||
# Run pc386 test harness w/ QEMU
|
||||
} elsif( $TA =~ /^RTEMS-pc386-qemu$/ ) {
|
||||
$exec = "qemu-system-i386 -m 64 -no-reboot -serial stdio -display none -net nic,model=ne2k_pci -net user,restrict=yes -kernel $exe";
|
||||
|
||||
# Explicitly fail for other RTEMS targets
|
||||
} elsif( $TA =~ /^RTEMS-/ ) {
|
||||
die "$0: I don't know how to create scripts for testing $TA on $HA\n";
|
||||
|
||||
} else {
|
||||
$exec = "./$exe";
|
||||
}
|
||||
|
||||
open(my $OUT, '>', $target) or die "Can't create $target: $!\n";
|
||||
|
||||
print $OUT <<EOF;
|
||||
#!/usr/bin/perl
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use Cwd 'abs_path';
|
||||
@@ -34,14 +59,7 @@ use Cwd 'abs_path';
|
||||
\$ENV{HARNESS_ACTIVE} = 1 if scalar \@ARGV && shift eq '-tap';
|
||||
\$ENV{TOP} = abs_path(\$ENV{TOP}) if exists \$ENV{TOP};
|
||||
|
||||
if (\$^O eq 'MSWin32') {
|
||||
# Use system on Windows, exec doesn't work the same there and
|
||||
# GNUmake thinks the test has finished as soon as Perl exits.
|
||||
system('./$exe') == 0 or die "Can't run $exe: \$!\\n";
|
||||
}
|
||||
else {
|
||||
exec './$exe' or die "Can't run $exe: \$!\\n";
|
||||
}
|
||||
system('$exec') == 0 or die "Can't run $exec: \$!\\n";
|
||||
EOF
|
||||
|
||||
close $OUT or die "Can't close $target: $!\n";
|
||||
|
||||
Reference in New Issue
Block a user