mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-03-26 08:41:47 -07:00
Merge branch/2016-09-12/job004020.
Copied from Perforce Change: 192325 ServerID: perforce.ravenbrook.com
This commit is contained in:
commit
bdfc695361
22 changed files with 238 additions and 169 deletions
|
|
@ -343,10 +343,9 @@ testratio: phony
|
|||
#
|
||||
# See test/README for documentation on running the MMQA test suite.
|
||||
|
||||
MMQA=perl test/qa -i ../code -l ../code/$(PFM)/$(VARIETY)/mps.o
|
||||
MMQA=perl test/qa -p $(PFM) -v $(VARIETY)
|
||||
|
||||
$(PFM)/$(VARIETY)/testmmqa:
|
||||
$(MAKE) -f $(PFM).gmk VARIETY=$(VARIETY) TARGET=mps.o variety
|
||||
(if [ "$(VARIETY)" = "cool" ]; then cd ../test && $(MMQA) runset testsets/coolonly; fi)
|
||||
(cd ../test && $(MMQA) runset testsets/argerr)
|
||||
(cd ../test && $(MMQA) runset testsets/conerr)
|
||||
|
|
|
|||
|
|
@ -1,66 +1,49 @@
|
|||
$Id$
|
||||
|
||||
This is the Memory Management QA test harness. To use it you need
|
||||
perl 5 (or higher). Go "perl qa help" for help, "perl qa options"
|
||||
to see what version of the harness you have (or look at the
|
||||
file "test/version").
|
||||
This is the Memory Management QA test harness. To use it you need Perl
|
||||
5 (or higher).
|
||||
|
||||
|
||||
Testing on Unix
|
||||
---------------
|
||||
Quick start
|
||||
-----------
|
||||
|
||||
From the test directory::
|
||||
In a shell in the test directory::
|
||||
|
||||
PLATFORM=lii6ll # substitute your platform
|
||||
VARIETY=cool # or hot
|
||||
CODE=../code # code directory of the branch you are testing
|
||||
make -B -C $CODE -f $PLATFORM.gmk VARIETY=$VARIETY $PLATFORM/$VARIETY/mps.o
|
||||
alias qa="perl test/qa -i $CODE -l $CODE/$PLATFORM/$VARIETY/mps.o"
|
||||
qa clib
|
||||
qa run function/5.c
|
||||
qa runset testsets/passing
|
||||
|
||||
Each test case is compiled in its turn to the file
|
||||
``test/obj/$(uname -s)_$(uname -r)_$(uname -p)__unix/tmp_test``
|
||||
so you can debug it with::
|
||||
|
||||
lldb test/obj/$(uname -s)_$(uname -r)_$(uname -p)__unix/tmp_test
|
||||
|
||||
Or ``gdb`` instead of ``lldb``. MMQA sets its own assertion handler,
|
||||
so you'll probably want to set a breakpoint on mmqa_assert_handler.
|
||||
perl test/qa clib
|
||||
perl test/qa run function/5.c
|
||||
perl test/qa runset testsets/passing
|
||||
perl test/qa debug argerr/12.c
|
||||
|
||||
|
||||
Testing on OS X
|
||||
---------------
|
||||
Usage and options
|
||||
-----------------
|
||||
|
||||
From the test directory, build mpslib.a using the Xcode project::
|
||||
Run ``perl test/qa help`` for help; run ``perl test/qa options`` to
|
||||
see what version of the harness you have (or look at the file
|
||||
``test/version``) and which options are available.
|
||||
|
||||
xcodebuild -project ../code/mps.xcodeproj -target mps
|
||||
|
||||
(You can also use "make" from the project root.) Then::
|
||||
|
||||
perl test/qa -i ../code -l ../code/xc/Debug/libmps.a clib
|
||||
perl test/qa -i ../code -l ../code/xc/Debug/libmps.a run function/232.c
|
||||
|
||||
etc. See "Testing on Unix" above.
|
||||
The most important options are the ``-p`` option which specifies the
|
||||
platform (for example, ``-p lii6ll``) if the auto-detected platform is
|
||||
not the one you want to test, and the ``-v`` option which specifies
|
||||
the variety (for example ``-v hot``) if the cool variety is not the
|
||||
one you want to test.
|
||||
|
||||
|
||||
Testing on Windows
|
||||
------------------
|
||||
Debugging
|
||||
---------
|
||||
|
||||
In a Cygwin shell, from the test directory::
|
||||
MMQA sets its own assertion handler, so you'll probably want to set a
|
||||
breakpoint on ``mmqa_assert_handler``.
|
||||
|
||||
PLATFORM=w3i6mv # substitute your platform
|
||||
VARIETY=cool # or hot
|
||||
CODE=../code # code directory of the branch you are testing
|
||||
pushd $CODE
|
||||
nmake /f $PLATFORM.nmk VARIETY=$VARIETY $PLATFORM/$VARIETY/mps.obj
|
||||
popd
|
||||
export LANG=C # avoid locale warnings from Perl.
|
||||
alias qa="perl test/qa -i $CODE -l $CODE/$PLATFORM/$VARIETY/mps.obj"
|
||||
qa clib
|
||||
qa run function/5.c
|
||||
qa runset testsets/passing
|
||||
|
||||
Windows
|
||||
-------
|
||||
|
||||
Use a Cygwin shell. Set the ``LANG`` environment variable::
|
||||
|
||||
export LANG=C
|
||||
|
||||
to avoid locale warnings from Perl.
|
||||
|
||||
The runset command can result in this error::
|
||||
|
||||
|
|
@ -72,12 +55,3 @@ Experience" service, and switching "Startup type" to "Automatic". See
|
|||
the documentation for LNK1168_.
|
||||
|
||||
.. _LNK1168: https://msdn.microsoft.com/en-us/library/hhbdtt6d.aspx
|
||||
|
||||
At present, the easiest way to debug a test case is to edit
|
||||
test/test/script/platform and set::
|
||||
|
||||
$comwrap = "vsjitdebugger \"";
|
||||
|
||||
But see job004020_.
|
||||
|
||||
.. _job004020: https://www.ravenbrook.com/project/mps/issue/job004020/
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ static void test(void) {
|
|||
cdie(mps_pool_create(&pool, arena, mps_class_mv(),
|
||||
1024*32, 1024*16, 1024*256), "pool");
|
||||
|
||||
cdie(mps_alloc(&q, pool, ((size_t)-1) - 100 * mmqaArenaSIZE), "alloc");
|
||||
cdie(mps_alloc(&q, pool, (size_t)-1 - mmqaArenaSIZE), "alloc");
|
||||
|
||||
mps_pool_destroy(pool);
|
||||
mps_arena_destroy(arena);
|
||||
|
|
|
|||
|
|
@ -60,11 +60,11 @@ static void alloc_back(void) {
|
|||
|
||||
static void test(void) {
|
||||
long int i;
|
||||
long int rsize;
|
||||
long int rsize = 0;
|
||||
|
||||
int inramp;
|
||||
|
||||
mycell *r, *s;
|
||||
mycell *r = NULL, *s;
|
||||
|
||||
cdie(mps_arena_create(&arena, mps_arena_class_vm(),
|
||||
(size_t) 1024*1024*ARENALIMIT),
|
||||
|
|
|
|||
|
|
@ -60,11 +60,11 @@ static void alloc_back(void) {
|
|||
|
||||
static void test(void) {
|
||||
long int i;
|
||||
long int rsize;
|
||||
long int rsize = 0;
|
||||
|
||||
int inramp;
|
||||
|
||||
mycell *r, *s;
|
||||
mycell *r = NULL, *s;
|
||||
|
||||
cdie(mps_arena_create(&arena, mps_arena_class_vm(),
|
||||
(size_t) 1024*1024*ARENALIMIT),
|
||||
|
|
|
|||
|
|
@ -60,11 +60,11 @@ static void alloc_back(void) {
|
|||
|
||||
static void test(void) {
|
||||
long int i;
|
||||
long int rsize;
|
||||
long int rsize = 0;
|
||||
|
||||
int inramp;
|
||||
|
||||
mycell *r, *s;
|
||||
mycell *r = NULL, *s;
|
||||
|
||||
cdie(mps_arena_create(&arena, mps_arena_class_vm(),
|
||||
(size_t) 1024*1024*ARENALIMIT),
|
||||
|
|
|
|||
|
|
@ -60,11 +60,11 @@ static void alloc_back(void) {
|
|||
|
||||
static void test(void) {
|
||||
long int i;
|
||||
long int rsize;
|
||||
long int rsize = 0;
|
||||
|
||||
int inramp;
|
||||
|
||||
mycell *r, *s;
|
||||
mycell *r = NULL, *s;
|
||||
|
||||
cdie(mps_arena_create(&arena, mps_arena_class_vm(),
|
||||
(size_t) ARENALIMIT),
|
||||
|
|
|
|||
|
|
@ -60,12 +60,12 @@ static void alloc_back(void) {
|
|||
|
||||
static void test(void) {
|
||||
long int i;
|
||||
long int rsize;
|
||||
long int rsize = 0;
|
||||
mps_message_t message;
|
||||
|
||||
int inramp;
|
||||
|
||||
mycell *r, *s;
|
||||
mycell *r = NULL, *s;
|
||||
|
||||
cdie(mps_arena_create(&arena, mps_arena_class_vm(),
|
||||
(size_t) 1024*1024*ARENALIMIT),
|
||||
|
|
|
|||
|
|
@ -60,12 +60,12 @@ static void alloc_back(void) {
|
|||
|
||||
static void test(void) {
|
||||
long int i;
|
||||
long int rsize;
|
||||
long int rsize = 0;
|
||||
mps_message_t message;
|
||||
|
||||
int inramp;
|
||||
|
||||
mycell *r, *s;
|
||||
mycell *r = NULL, *s;
|
||||
|
||||
cdie(mps_arena_create(&arena, mps_arena_class_vm(),
|
||||
(size_t) 1024*1024*ARENALIMIT),
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ static void alloc_back(void) {
|
|||
|
||||
static void test(void) {
|
||||
long int i;
|
||||
long int rsize;
|
||||
long int rsize = 0;
|
||||
|
||||
int inramp;
|
||||
|
||||
mycell *r1, *r2, *s1, *s2;
|
||||
mycell *r1 = NULL, *r2 = NULL, *s1, *s2;
|
||||
|
||||
cdie(mps_arena_create(&arena1, mps_arena_class_vm(),
|
||||
(size_t) 1024*1024*ARENALIMIT), "create arena");
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
1;
|
||||
|
||||
use Cwd;
|
||||
use File::Path qw(rmtree);
|
||||
|
||||
sub clib {
|
||||
|
|
@ -15,6 +16,7 @@ sub clib {
|
|||
my $tlobj;
|
||||
|
||||
&objpurge();
|
||||
&mpslibbuild();
|
||||
&scrutinize();
|
||||
&logcomment("Compiling test libraries.");
|
||||
|
||||
|
|
@ -59,6 +61,19 @@ sub objpurge {
|
|||
closedir(DIR);
|
||||
}
|
||||
|
||||
#
|
||||
# Build the MPS object file.
|
||||
#
|
||||
|
||||
sub mpslibbuild {
|
||||
&logcomment("Building MPS library.");
|
||||
local $dir = cwd();
|
||||
chdir($MPS_INCLUDE_DIR);
|
||||
&mysystem($make_command);
|
||||
chdir($dir);
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# record information about environment so that when running tests
|
||||
# we can check the libraries are still applicable
|
||||
|
|
|
|||
|
|
@ -8,15 +8,9 @@
|
|||
&requiredoptions(
|
||||
"MPS_INCLUDE_DIR",
|
||||
"MPS_LINK_OBJ",
|
||||
# "MPS_INTERFACE_VERSION",
|
||||
"VARIETY",
|
||||
"PLATFORM"
|
||||
);
|
||||
|
||||
&linkobjtimes();
|
||||
|
||||
&requiredoptions(
|
||||
"MPS_PRODUCT"
|
||||
);
|
||||
|
||||
&clib;
|
||||
|
||||
|
|
|
|||
16
mps/test/test/script/commands/debug
Normal file
16
mps/test/test/script/commands/debug
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/perl -w
|
||||
# $Id$
|
||||
#
|
||||
# debug a test
|
||||
|
||||
&requiredoptions(
|
||||
"MPS_INCLUDE_DIR",
|
||||
"MPS_LINK_OBJ",
|
||||
"VARIETY",
|
||||
"PLATFORM",
|
||||
"LOG_DIR"
|
||||
);
|
||||
|
||||
foreach $testfile (@ARGV) {
|
||||
&debugtest($testfile);
|
||||
}
|
||||
|
|
@ -7,8 +7,7 @@
|
|||
&requiredoptions(
|
||||
"MPS_INCLUDE_DIR",
|
||||
"MPS_LINK_OBJ",
|
||||
# "MPS_INTERFACE_VERSION",
|
||||
"MPS_PRODUCT",
|
||||
"VARIETY",
|
||||
"PLATFORM",
|
||||
"LOG_DIR"
|
||||
);
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@
|
|||
&requiredoptions(
|
||||
"MPS_INCLUDE_DIR",
|
||||
"MPS_LINK_OBJ",
|
||||
# "MPS_INTERFACE_VERSION",
|
||||
"MPS_PRODUCT",
|
||||
"VARIETY",
|
||||
"PLATFORM",
|
||||
"LOG_DIR"
|
||||
);
|
||||
|
|
|
|||
|
|
@ -85,6 +85,9 @@ sub readheader {
|
|||
} else {
|
||||
$testid = $test_header{"id"};
|
||||
}
|
||||
if (length($testid) > 70) {
|
||||
$testid = substr($testid, 0, 33) . "..." . substr($testid, -33);
|
||||
}
|
||||
if (! exists $test_header{"harness"}) {
|
||||
$test_header{"harness"} = "1.0";
|
||||
}
|
||||
|
|
|
|||
11
mps/test/test/script/help/debug
Normal file
11
mps/test/test/script/help/debug
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
debug a test
|
||||
% $Id$
|
||||
|
||||
Usage: qa debug [<options>] <testfile>
|
||||
|
||||
'debug' launches a test in the debugger. The test libraries should
|
||||
previously have been compiled with 'clib'; if the harness believes the
|
||||
test libraries may not be up-to-date, it will give an error and ask
|
||||
you to run 'clib' first. (You can force the harness to run a test with
|
||||
potentially out-of-date libraries by specifying the "-danger" option
|
||||
to 'debug'. This is not recommended.)
|
||||
|
|
@ -20,19 +20,14 @@ If the option is _cumulative_, however, both will apply.
|
|||
What the options mean:
|
||||
|
||||
MMQA_MPS_INCLUDE_DIR / -i
|
||||
a directory where the MM header files may be found. No default.
|
||||
a directory where the MPS source code may be found. Defaults to the
|
||||
code directory relative to the test script.
|
||||
|
||||
MMQA_MPS_LINK_OBJ / -l
|
||||
the MM libraries and plinth to link with. Separate multiple files
|
||||
with spaces. (Spaces in the paths will make the test harness go
|
||||
wrong, unfortunately.) No default.
|
||||
|
||||
MMQA_MPS_PRODUCT / -prod
|
||||
You won't normally need to (and shouldn't) set this option, which
|
||||
will default to "epcore" or "dylan", whichever is appropriate to
|
||||
the memory manager specified in MMQA_MPS_LINK_OBJ. If however you
|
||||
want to test a memory manager which predates MPS version
|
||||
identification, then you must set it manually.
|
||||
wrong, unfortunately.) Defaults to the appropriate file for the
|
||||
platform and variety.
|
||||
|
||||
MMQA_LOG_DIR / -g
|
||||
the directory in which log files should be saved. Default is
|
||||
|
|
@ -50,6 +45,9 @@ MMQA_PLATFORM / -p
|
|||
running tests. Setting it to a value not appropriate to the
|
||||
machine you are using will make the test system go wrong.
|
||||
|
||||
MMQA_VARIETY / -v
|
||||
the MPS variety to test. Defaults to cool.
|
||||
|
||||
MMQA_PARAMETERS / -a (cumulative)
|
||||
parameter settings to use for a test. These override any parameter
|
||||
settings specified in the test header. Examples (all equivalent):
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ sub harness_init {
|
|||
&set_dirs;
|
||||
&platform_settings;
|
||||
&identify;
|
||||
&auto_settings;
|
||||
&platform_settings;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,43 +14,49 @@
|
|||
|
||||
sub platform_detect {
|
||||
if (($ENV{"OS"} || "") eq "Windows_NT") {
|
||||
# it's NT, so find out what the processor is
|
||||
# from a system variable
|
||||
$platform_class = "nt_".$ENV{"PROCESSOR_ARCHITECTURE"};
|
||||
if ($platform_class eq "nt_") {
|
||||
$platform_class = "nt_dunno";
|
||||
$platform_os = "w3";
|
||||
# See https://msdn.microsoft.com/en-us/library/aa384274.aspx
|
||||
if ($ENV{"PROCESSOR_ARCHITECTURE"} eq "x86") {
|
||||
$platform_ar = "i3";
|
||||
} elsif ($ENV{"PROCESSOR_ARCHITECTURE"} eq "AMD64") {
|
||||
$platform_ar = "i6";
|
||||
} else {
|
||||
$platform_ar = "xx";
|
||||
}
|
||||
$platform_phylum = "pc";
|
||||
$platform_ct = "mv";
|
||||
} else {
|
||||
# it's unix by default
|
||||
local $os = `uname`;
|
||||
local $osrel = `uname -r`;
|
||||
local $processor = `uname -p`;
|
||||
chomp($os); chomp($osrel); chomp($processor);
|
||||
$platform_class = $os."_".$osrel."_".$processor;
|
||||
$platform_class =~ s/ /_/g;
|
||||
$platform_phylum = "unix";
|
||||
}
|
||||
$qa_defaults{"PLATFORM"} = $platform_class."__".$platform_phylum;
|
||||
}
|
||||
|
||||
sub auto_settings {
|
||||
unless (&getoption("MPS_PRODUCT")) {
|
||||
if (&getoption("MPS_LINK_OBJ")) {
|
||||
&mpslibvers(&getoption("MPS_LINK_OBJ"));
|
||||
unless ($mpslibvers{"product"} eq "unknown") {
|
||||
&setoption("MPS_PRODUCT", $mpslibvers{"product"});
|
||||
}
|
||||
local $os = `uname -s`;
|
||||
chomp($os);
|
||||
if ($os eq "Darwin") {
|
||||
$platform_os = "xc";
|
||||
$platform_ct = "ll";
|
||||
} elsif ($os eq "FreeBSD") {
|
||||
$platform_os = "fr";
|
||||
$platform_ct = "gc";
|
||||
} elsif ($os eq "Linux") {
|
||||
$platform_os = "li";
|
||||
$platform_ct = "gc";
|
||||
} else {
|
||||
$platform_os = "xx";
|
||||
$platform_ct = "xx";
|
||||
}
|
||||
local $processor = `uname -m`;
|
||||
chomp($processor);
|
||||
if ($processor eq "i386") {
|
||||
$platform_ar = "i3";
|
||||
} elsif ($processor eq "x86_64") {
|
||||
$platform_ar = "i6";
|
||||
} else {
|
||||
$platform_ar = "xx";
|
||||
}
|
||||
}
|
||||
$qa_defaults{"PLATFORM"} = $platform_os . $platform_ar . $platform_ct;
|
||||
}
|
||||
|
||||
|
||||
%qa_options = (
|
||||
# "v", "MPS_INTERFACE_VERSION",
|
||||
"v", "VARIETY",
|
||||
"i", "MPS_INCLUDE_DIR",
|
||||
"l", "MPS_LINK_OBJ",
|
||||
"prod", "MPS_PRODUCT",
|
||||
"p", "PLATFORM",
|
||||
"data", "DATA_DIR",
|
||||
"a", "PARAMETERS",
|
||||
|
|
@ -73,13 +79,14 @@ sub auto_settings {
|
|||
#
|
||||
|
||||
%qa_defaults = (
|
||||
"MPS_INCLUDE_DIR", $test_dir . "/../../code",
|
||||
"PLATFORM", "[error -- you shouldn't see this]",
|
||||
"VARIETY", "cool",
|
||||
"DEBUG_INFO", "off",
|
||||
"DANGEROUS", "off",
|
||||
"DATA_DIR", "$test_dir/../data",
|
||||
"LOG_DIR", "$test_dir/log",
|
||||
"PARAMETERS", "",
|
||||
# "MPS_INTERFACE_VERSION", "HU",
|
||||
"MAIL_RESULTS", "off",
|
||||
"MAIL_TO", "mm-qa-test-log",
|
||||
"MAIL_SUBJECT", "MMQA-log"
|
||||
|
|
|
|||
|
|
@ -13,43 +13,39 @@
|
|||
# Set lots of variables correctly, depending on the platform
|
||||
# (which was determined in 'options')
|
||||
#
|
||||
# Currently, it should work correctly on NT, Solaris, Linux, MacOS X.
|
||||
# Currently, it should work correctly on Windows, Linux, MacOS X,
|
||||
# FreeBSD.
|
||||
#
|
||||
|
||||
sub platform_settings {
|
||||
if ($PLATFORM =~ "^nt_") {
|
||||
&settings_nt();
|
||||
if ($PLATFORM =~ "^nt_x86_cap") {
|
||||
&settings_nt_cap();
|
||||
} elsif ($PLATFORM =~ "^nt_x86_coff") {
|
||||
&settings_nt_coff();
|
||||
}
|
||||
} elsif ($PLATFORM =~ "^SunOS") {
|
||||
&settings_unix();
|
||||
if ($PLATFORM =~ "sos8gp") {
|
||||
&settings_gprof();
|
||||
}
|
||||
} elsif ($PLATFORM =~ "^Linux") {
|
||||
&settings_unix();
|
||||
&settings_linux();
|
||||
} elsif ($PLATFORM =~ "^Mac_OS_10" || $PLATFORM =~ "^Darwin_") {
|
||||
&settings_unix();
|
||||
&settings_macosx();
|
||||
} elsif ($PLATFORM =~ "__unix") {
|
||||
&logcomment("I don't know anything specific about $PLATFORM --");
|
||||
&logcomment("using generic unix/gcc settings.");
|
||||
&settings_unix();
|
||||
} else {
|
||||
die "Sorry: I don't know how to use ".$PLATFORM."\n";
|
||||
}
|
||||
if ($PLATFORM =~ "^w3") {
|
||||
&settings_nt();
|
||||
&settings_nt_coff();
|
||||
} elsif ($PLATFORM =~ "^li") {
|
||||
&settings_unix();
|
||||
&settings_linux();
|
||||
} elsif ($PLATFORM =~ "^xc") {
|
||||
&settings_unix();
|
||||
&settings_macosx();
|
||||
} elsif ($PLATFORM =~ "^fr") {
|
||||
&settings_unix();
|
||||
&settings_freebsd();
|
||||
} else {
|
||||
die "Sorry: I don't know how to use $PLATFORM.\n";
|
||||
}
|
||||
unless (defined $MPS_LINK_OBJ && $MPS_LINK_OBJ ne "") {
|
||||
$MPS_LINK_OBJ = "$MPS_INCLUDE_DIR/$link_obj";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub settings_nt {
|
||||
$dirsep = "/";
|
||||
$link_obj = "$PLATFORM/$VARIETY/mps.obj";
|
||||
$make_command = "nmake /f $PLATFORM.nmk VARIETY=$VARIETY $link_obj";
|
||||
$debug_command = "vsjitdebugger";
|
||||
$cc_command = "cl";
|
||||
# following line used to include /DMMQA_VERS_$MPS_INTERFACE_VERSION
|
||||
$cc_opts = "/nologo /DWIN32 /D_WINDOWS /D_CRT_SECURE_NO_WARNINGS /W3 /Zi /Oy- /MD /DMMQA_PROD_$MPS_PRODUCT";
|
||||
$cc_opts = "/nologo /DWIN32 /D_WINDOWS /D_CRT_SECURE_NO_WARNINGS /W3 /Zi /Oy- /MD";
|
||||
$cc_link = "$obj_dir/platform.obj";
|
||||
$cc_link_opts = "/link /NODEFAULTLIB:LIBCMT /NODEFAULTLIB:LIBCMTD /NODEFAULTLIB:LIBC /NODEFAULTLIB:LIBCD /NODEFAULTLIB:MSVCRTD /DEFAULTLIB:MSVCRT /debug";
|
||||
$cc_include = "/I$testlib_dir /I$MPS_INCLUDE_DIR /I$obj_dir";
|
||||
|
|
@ -90,14 +86,24 @@ sub settings_nt_coff {
|
|||
|
||||
sub settings_unix {
|
||||
$dirsep = "/";
|
||||
$link_obj = "$PLATFORM/$VARIETY/mps.o";
|
||||
$make_command = "make -B -f $PLATFORM.gmk VARIETY=$VARIETY $link_obj";
|
||||
$cc_link = "$obj_dir/platform.o -lm";
|
||||
$cc_link_opts = "-z muldefs";
|
||||
$cc_command = "gcc";
|
||||
if ($PLATFORM =~ /ll$/) {
|
||||
$cc_command = "clang";
|
||||
$debug_command = "lldb";
|
||||
} elsif ($PLATFORM =~ /gc$/) {
|
||||
$cc_command = "gcc";
|
||||
$debug_command = "gdb";
|
||||
} else {
|
||||
$cc_command = "cc";
|
||||
$debug_command = "gdb";
|
||||
}
|
||||
$cc_opts = "-ansi -pedantic -Wall -Wstrict-prototypes ".
|
||||
"-Winline -Waggregate-return -Wnested-externs -Wcast-qual ".
|
||||
"-Wshadow -Wmissing-prototypes -Wcast-align ".
|
||||
"-O -g -ggdb3 ".
|
||||
"-DMMQA_PROD_$MPS_PRODUCT";
|
||||
"-O -g -ggdb3 ";
|
||||
$cc_include = "-I$testlib_dir -I$MPS_INCLUDE_DIR -I$obj_dir";
|
||||
$cc_def = "-D";
|
||||
$cc_defeq = "=";
|
||||
|
|
@ -109,8 +115,12 @@ sub settings_unix {
|
|||
$obj_suffix = ".o";
|
||||
$try_command = "sh -c ";
|
||||
$catcommand = "cat";
|
||||
$comwrap = "sh -c \"ulimit -c 0; ";
|
||||
$comwrapend = "\"";
|
||||
$comwrap = "sh -c 'ulimit -c 0; ";
|
||||
# The "true" after the test program forces the test program to be run
|
||||
# inside the subshell (with "Segmentation fault" messages written to
|
||||
# the pipe and captured) rather than in the parent shell (with
|
||||
# "Segmentation fault" messages written to the terminal and so lost).
|
||||
$comwrapend = "; true'";
|
||||
$stdout_red = ">";
|
||||
$stdout_dup = "| tee";
|
||||
$stdin_red = "<";
|
||||
|
|
@ -130,18 +140,31 @@ sub settings_gprof {
|
|||
|
||||
|
||||
sub settings_linux {
|
||||
$cc_link = $cc_link . " -lpthread";
|
||||
$cc_link .= " -lpthread";
|
||||
}
|
||||
|
||||
|
||||
sub settings_freebsd {
|
||||
$make_command = "gmake -B -f $PLATFORM.gmk VARIETY=$VARIETY $link_obj";
|
||||
$cc_link .= " -lpthread";
|
||||
}
|
||||
|
||||
|
||||
sub settings_macosx {
|
||||
$cc_command = "cc";
|
||||
$cc_link = "$obj_dir/platform.o";
|
||||
$cc_link_opts =~ s/-z muldefs//;
|
||||
$cc_opts =~ s/-Wstrict-prototypes//;
|
||||
$cc_opts .= " -Wno-unused -Wno-missing-prototypes";
|
||||
$stdboth_red = ">&%s";
|
||||
$preprocommand = "$cc_command $cc_preonly";
|
||||
local $config = "Debug";
|
||||
if ($VARIETY eq "hot") {
|
||||
$config = "Release";
|
||||
} elsif ($VARIETY eq "rash") {
|
||||
$config = "Rash";
|
||||
}
|
||||
$link_obj = "xc/$config/libmps.a";
|
||||
$make_command = "xcodebuild -project mps.xcodeproj -config $config -target mps";
|
||||
$debug_command = "lldb";
|
||||
$cc_command = "clang";
|
||||
$cc_link = "$obj_dir/platform.o";
|
||||
$cc_link_opts =~ s/-z muldefs//;
|
||||
$cc_opts =~ s/-Wstrict-prototypes//;
|
||||
$cc_opts .= " -Wno-unused -Wno-missing-prototypes";
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -191,9 +214,9 @@ sub unix_mailfile {
|
|||
|
||||
sub identify {
|
||||
%identify = ();
|
||||
if ($PLATFORM =~ /^nt/) {
|
||||
if ($PLATFORM =~ /^w3/) {
|
||||
&identify_nt;
|
||||
} elsif ($PLATFORM =~ /__unix/) {
|
||||
} elsif ($PLATFORM =~ /^(fr|li|xc)/) {
|
||||
&identify_unix;
|
||||
}
|
||||
$identify{"time"} = localtime;
|
||||
|
|
@ -237,7 +260,7 @@ sub identify_unix {
|
|||
if (exists $identify{"user"}) {
|
||||
$identify{"user"} =~ s/\s.*//;
|
||||
}
|
||||
&comvar("c_version", "gcc -v", "version");
|
||||
&comvar("c_version", "$cc_command -v", "version");
|
||||
&comvar("OS", "uname", "");
|
||||
&comvar("arch", "uname -a", "");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,3 +269,35 @@ sub missingTestSymbols {
|
|||
return &missingSymbols(&listFileSymbols($testfile));
|
||||
}
|
||||
|
||||
|
||||
sub debugtest {
|
||||
local ($testfile,) = @_;
|
||||
|
||||
&readheader($testfile, 1);
|
||||
|
||||
unless (vleq($test_header{"harness"}, $HARNESS_VERSION)) {
|
||||
die "This test requires version $test_header{\"harness\"} or later of the MMQA harness.
|
||||
(You are using version $HARNESS_VERSION.)\n";
|
||||
}
|
||||
|
||||
for $lang ($test_header{"language"}) {
|
||||
if ($lang =~ /^c$/) {
|
||||
unless ($DANGEROUS eq "on") {
|
||||
$_ = &test_clib();
|
||||
if ($_) {
|
||||
print "Warning: $_\n";
|
||||
die "-- recompile test libraries (\"qa clib\") before debugging tests.\n";
|
||||
}
|
||||
}
|
||||
$linkfiles = $test_header{"link"};
|
||||
$objfile = "$obj_dir/tmp_test";
|
||||
if (&compile_and_link($testfile, $objfile, $linkfiles)) {
|
||||
mysystem("$debug_command $objfile")
|
||||
} else {
|
||||
die "compilation failed:\n$compoutput";
|
||||
}
|
||||
} else {
|
||||
die "Don't know how to debug tests in the $lang language.\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue