Add RTEMS-pc686-qemu for use on RTEMS 5.x

RTEMS 5.x moved the PC BSP to 686. This commit makes the EPICS
target match; RTEMS-pc386 and the -qemu variant can only be built
when RTEMS_VERSION != 5, whereas RTEMS-pc686 and its -qemu version
will only build when RTEMS_VERSION == 5 (there are checks with
descriptive errors included).

makeTestFile.pl was also reformatted and modified to use exec to
run tests on non-Windows hosts as required by the Perl test harness.
This commit is contained in:
Andrew Johnson
2020-09-25 17:57:31 -05:00
committed by Brendan Chandler
parent 708cecfadc
commit ec94351a5e
7 changed files with 88 additions and 71 deletions

View File

@ -1,10 +1,10 @@
# CONFIG.Common.RTEMS-pc386
#
# Author: W. Eric Norum
# Canadian Light Source
# eric@cls.usask.ca
#
# All RTEMS targets use the same Makefile fragment
# Definitions for the RTEMS-pc386 target, RTEMS 4.x only
# Site-specific overrides go in CONFIG_SITE.Common.RTEMS-pc386
#
#-------------------------------------------------------
RTEMS_BSP = pc386
RTEMS_TARGET_CPU = i386
GNU_TARGET = i386-rtems
@ -23,3 +23,10 @@ include $(CONFIG)/os/CONFIG.Common.RTEMS
# Put text segment where it will work with etherboot
#
OP_SYS_LDFLAGS += -Wl,-Ttext,0x100000
# This check must appear after the above include
ifeq ($(RTEMS_VERSION),5)
$(info *** This target is not compatible with the configured RTEMS version.)
$(info *** Build the RTEMS-pc686 (-qemu) target for RTEMS 5.x)
$(error Can't continue)
endif

View File

@ -6,7 +6,6 @@
#-------------------------------------------------------
# Include definitions from RTEMS-pc386
# For Tests overwrite it with pc686
include $(CONFIG)/os/CONFIG.Common.RTEMS-pc686
include $(CONFIG)/os/CONFIG.Common.RTEMS-pc386
RTEMS_QEMU_FIXUPS = YES

View File

@ -1,10 +1,10 @@
# CONFIG.Common.RTEMS-pc686
#
# Author: W. Eric Norum
# Canadian Light Source
# eric@cls.usask.ca
#
# All RTEMS targets use the same Makefile fragment
# Definitions for the RTEMS-pc686 target, RTEMS 5.x only
# Site-specific overrides go in CONFIG_SITE.Common.RTEMS-pc686
#
#-------------------------------------------------------
RTEMS_BSP = pc686
RTEMS_TARGET_CPU = i386
GNU_TARGET = i386-rtems
@ -23,3 +23,10 @@ include $(CONFIG)/os/CONFIG.Common.RTEMS
# Put text segment where it will work with etherboot
#
OP_SYS_LDFLAGS += -Wl,-Ttext,0x100000
# This check must appear after the above include
ifneq ($(RTEMS_VERSION),5)
$(info *** This target is not compatible with the configured RTEMS version.)
$(info *** Build the RTEMS-pc386 (-qemu) target for RTEMS 4.x)
$(error Can't continue)
endif

View File

@ -0,0 +1,11 @@
# CONFIG.Common.RTEMS-pc686-qemu
#
# Definitions for the RTEMS-pc686-qemu target
# Site-specific overrides go in CONFIG_SITE.Common.RTEMS-pc686-qemu
#
#-------------------------------------------------------
# Include definitions from RTEMS-pc686
include $(CONFIG)/os/CONFIG.Common.RTEMS-pc686
RTEMS_QEMU_FIXUPS = YES

View File

@ -6,4 +6,4 @@
# If you're building this architecture you _probably_ want to
# run the tests for it under QEMU, but if not you can turn
# them off here by commenting out this line:
CROSS_COMPILER_RUNTEST_ARCHS += RTEMS-pc386-qemu
CROSS_COMPILER_RUNTEST_ARCHS += $(T_A)

View File

@ -0,0 +1,9 @@
# CONFIG_SITE.Common.RTEMS-pc686-qemu
#
# Site-specific overrides for the RTEMS-pc686-qemu target
#
# If you're building this architecture you _probably_ want to
# run the tests for it under QEMU, but if not you can turn
# them off here by commenting out this line:
CROSS_COMPILER_RUNTEST_ARCHS += $(T_A)

View File

@ -24,75 +24,59 @@
use strict;
my ($TA, $HA, $target, $exe) = @ARGV;
my $exec;
my ($exec, $error);
# 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=e1000 -net nic,model=ne2k_pci -net user,restrict=yes -append --console=/dev/com1 -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";
if ($TA =~ /^win32-x86/ && $HA !~ /^win/) {
# Use WINE to run win32-x86 executables on non-windows hosts.
# New Debian derivatives have wine32 and wine64, older ones have
# wine and wine64. We prefer wine32 if present.
my $wine32 = "/usr/bin/wine32";
$wine32 = "/usr/bin/wine" if ! -x $wine32;
$error = $exec = "$wine32 $exe";
}
elsif ($TA =~ /^windows-x64/ && $HA !~ /^win/) {
# Use WINE to run windows-x64 executables on non-windows hosts.
$error = $exec = "wine64 $exe";
}
elsif ($TA =~ /^RTEMS-pc[36]86-qemu$/) {
# Run the pc386 and pc686 test harness w/ QEMU
$exec = "qemu-system-i386 -m 64 -no-reboot "
. "-serial stdio -display none "
. "-net nic,model=e1000 -net nic,model=ne2k_pci "
. "-net user,restrict=yes "
. "-append --console=/dev/com1 "
. "-kernel $exe";
$error = "qemu-system-i386 ... -kernel $exe";
}
elsif ($TA =~ /^RTEMS-/) {
# Explicitly fail for other RTEMS targets
die "$0: I don't know how to create scripts for testing $TA on $HA\n";
}
else {
# Assume it's directly executable on other targets
$error = $exec = "./$exe";
}
# Ensure that Windows interactive error handling is disabled.
# This setting is inherited by the test process.
# Set SEM_FAILCRITICALERRORS (1) Disable critical-error-handler dialog
# Clear SEM_NOGPFAULTERRORBOX (2) Enabled WER to allow automatic post mortem debugging (AeDebug)
# Clear SEM_NOALIGNMENTFAULTEXCEPT (4) Allow alignment fixups
# Set SEM_NOOPENFILEERRORBOX (0x8000) Prevent dialog on some I/O errors
# https://docs.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-seterrormode?redirectedfrom=MSDN
my $sem = $^O ne 'MSWin32' ? '' : <<ENDBEGIN;
BEGIN {
my \$sem = 'SetErrorMode';
eval {
require Win32::ErrorMode;
Win32::ErrorMode->import(\$sem);
};
eval {
require Win32API::File;
Win32API::File->import(\$sem);
} if \$@;
SetErrorMode(0x8001) unless \$@;
}
ENDBEGIN
# Run the test program with system on Windows, exec elsewhere.
# This is required by the Perl test harness.
my $runtest = ($^O eq 'MSWin32') ?
"system('$exec') == 0" : "exec '$exec'";
open(my $OUT, '>', $target) or die "Can't create $target: $!\n";
open my $OUT, '>', $target
or die "Can't create $target: $!\n";
print $OUT <<EOF;
print $OUT <<__EOF__;
#!/usr/bin/env perl
use strict;
use Cwd 'abs_path';
$sem
\$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 too soon.
my \$status = system('$exec');
die "Can't run $exec: \$!\\n" if \$status == -1;
exit \$status >> 8;
}
else {
exec '$exec' or die "Can't run $exec: \$!\\n";
}
EOF
$runtest
or die "Can't run $error: \$!\\n";
__EOF__
close $OUT or die "Can't close $target: $!\n";
close $OUT
or die "Can't close $target: $!\n";