aboutsummaryrefslogtreecommitdiff
path: root/sim/testsuite/lib
AgeCommit message (Collapse)AuthorFilesLines
2023-08-19sim prune_warningsAlan Modra1-0/+19
Remove some of the warnings generated by newer versions of ld. * testsuite/lib/sim-defs.exp (prune_warnings_extra): New. Arrange to run it from prune_warnings.
2022-02-15sim/testsuite: Default global_cc_os and global_cc_works properlyHans-Peter Nilsson1-4/+2
There was an omission on 3e6dc39ed7a8 "sim/testsuite: Set global_cc_os also when no compiler is found"; global_cc_os wasn't set for other than the primary target, which means that the "unguarded" use of global_cc_os in testsuite/cris/c/c.exp caused the dreaded "ERROR: can't read "global_cc_os": no such variable" when e.g. configuring for pru-elf and doing "make check-sim". Better initializing both variables at the top to default values, rather than adding another single 'set global_cc_os ""', to reduce the risk of not setting them properly if or when that if-statement-chain is made longer. sim/testsuite: * lib/sim-defs.exp (sim_init_toolchain): Default global_cc_os and global_cc_works properly, before if-chain.
2022-02-14sim/testsuite: Support "requires: simoption <--name-of-option>"Hans-Peter Nilsson1-0/+60
Simulator features can be present or not, typically depending on different-valued configure options, like --enable-sim-hardware[=off|=on]. To avoid failures in test-suite-runs when testing such configurations, a new predicate is needed, as neither "target", "progos" nor "mach" fits cleanly. The immediate need was to check for presence of a simulator option, but rather than a specialized "requires-simoption:" predicate I thought I'd handle the general (parametrized) need, so here's a generic predicate machinery and a (first) predicate to use together with it; checking whether a particular option is supported, by looking at "run --help" output. This was inspired by the check_effective_target_ machinery in the gcc test-suite. Multiple "requires: <requirement> <parameter>" form a list of predicates (with parameters), to be used as a conjunction. sim/testsuite: * lib/sim-defs.exp (sim_check_requires_simoption): New function. (run_sim_test): Support "requires: <requirement> <parameter>".
2022-02-14sim/testsuite: Set global_cc_os also when no compiler is foundHans-Peter Nilsson1-0/+1
If we don't set this variable, it doesn't exist, and using "#progos:" in an assembler-file will cause an error rather than just skipping the test, viz: Running /src/sim/testsuite/cris/hw/rv-n-cris/rvc.exp ... ERROR: tcl error sourcing /src/sim/testsuite/cris/hw/rv-n-cris/rvc.exp. ERROR: can't read "global_cc_os": no such variable while executing "if { $opts(progos) != "" && $opts(progos) != $global_cc_os } { untested $subdir/$name return }" (procedure "run_sim_test" line 102) Neither the commit introducing progos, nor the top comment in run_sim_test, mentions progos as intended only for C tests, or that its use must be gated on $global_cc_works != 0, so (not) setting it in the no-working-compiler path seems just overlooked. Allowing it to be used for assembler tests makes it usable for e.g. an always-false predicate and in expressions in .exp files without gating on $global_cc_works != 0. With this patch, global_cc_os is set to "", just as for "unknown OS". sim/testsuite: * lib/sim-defs.exp (sim_init_toolchain): Set global_cc_os also when no working target C compiler is found.
2021-11-28sim: testsuite: expand arch specific toolchain settingsMike Frysinger1-7/+61
Leverage the new per-port toolchain settings to initialize the env for eeach set of tests. This allows us to run all the tests in a multitarget build if the user sets up the vars. If they don't, we can still skip all the tests.
2021-11-27sim: testsuite: add dedicated flag for init toolchain testsMike Frysinger1-4/+13
As we setup more reliable CC_FOR_TARGET variables for each target, the bfin way of overriding it to stuff custom CFLAGS doesn't scale well. Add a dedicated CFLAGS_FOR_TARGET_init setting that each set of tests can setup if they want to add custom options.
2021-11-27sim: testsuite: clean up arch specific toolchain settingsMike Frysinger1-0/+14
In a multitarget build, we process all targets in order, so make sure the toolchain settings from one don't leak into the next.
2021-11-26sim: testsuite: initial support for OS-specific testsMike Frysinger3-4/+48
We usually test against the newlib/libgloss environment, but for a few ports that also support Linux apps, we want to test that logic too. A lot of the C code is written such that it works with either newlib/libgloss or glibc/linux toolchains, but we have some tests that end up being Linux-specific. Cris has been using the target tuple as a rough proxy for this (where cris*-*-elf is assumed to be newlib/libgloss, and everything else is glibc/linux), but that is a bit too rough, and it doesn't work in a multitarget build. So lets create a few stub files that we can do compile tests with to detect the different setups, and then let tests declare which one they require (if they require any at all).
2021-11-26sim: testsuite: unify basic C compiler checksMike Frysinger2-0/+43
Both bfin & cris ports test the C compiler to see if it works, but in their own way. Unify the checks in the common code so we can leverage them in more ports in the future, and collapse the bfin & cris code.
2021-11-26sim: testsuite: rework sim_init usageMike Frysinger1-22/+21
The sim_init function was called by runtest for each test when --tool was set to sim. When we changed to --tool '' to collapse the testsuite dir, the init function was no longer called on every test. However, it was still being called explicitly by config/default.exp. It's not clear why that explicit call ever existed since, in the past, it meant it was redundant. Lets drop the single sim_init call in config/default.exp and move it out to all our tests. This replicates the runtest behavior so we can setup variables on a per-test basis which allows us to recollapse the sim_path logic back. We'll also leverage this in the future for toolchain setup. Also add a few comments clarifying the overall runtime behavior.
2021-11-26sim: testsuite: fix objdir handlingMike Frysinger1-10/+10
The tests assume that the cwd is the objdir directory and write its intermediates to there all the time. When using runtest's --objdir setting though, this puts the files in the wrong place. This isn't a big problem currently as we never change --objdir, but in order to support parallel test execution, we're going to start setting that option, so clean up the code ahead of time. We also have to tweak some of the cris tests which were making assumptions about the argv[0] value.
2021-11-26sim: testsuite: rename global_sim_options to SIMFLAGS_FOR_TARGETMike Frysinger1-4/+4
Now that all the other toolchain settings have been renamed to match the dejagnu settings of XXX_FOR_TARGET, rename global_sim_options to SIMFLAGS_FOR_TARGET too.
2021-11-26sim: testsuite: replace global_ld_options with LDFLAGS_FOR_TARGETMike Frysinger1-6/+2
Only a few tests actually use global_ld_options, but we can replace the sim-specific settings with the dejagnu common LDFLAGS_FOR_TARGET and get the same result.
2021-11-26sim: testsuite: replace global_as_options with ASFLAGS_FOR_TARGETMike Frysinger1-6/+2
Only a few tests actually use global_as_options, but we can replace the sim-specific settings with the dejagnu common ASFLAGS_FOR_TARGET and get the same result.
2021-11-26sim: testsuite: drop unused global_cc_optionsMike Frysinger1-5/+1
Nothing in the testsuite is using this setting, so let's drop it. Any code that wants to set compiler flags can use CFLAGS_FOR_TARGET instead to get the same effect.
2021-11-26sim: testsuite: punt unused toolchain variablesMike Frysinger1-6/+3
These haven't been used in over 20 years. The sim testsuite used to run these tools itself directly, but back in ~1999 it switched to the dejagnu helpers (e.g. target_assemble & target_link), and the dejagnu logic only utilizes XXX_FOR_TARGET variables. Punt them here to avoid confusion with dead code.
2021-11-20sim: v850: fix cpu_option testsuite handlingMike Frysinger1-1/+7
The v850 testsuite code has been testing the $opt variable, but this was never actually set anywhere globally or v850-specific. Instead, this was a random variable leaking out of the sh testsuite code. As far as I can tell, it has always been this way. That means the code only ever tested the v850 cpu target (which is the default). This failure can be easily seen in practice by running the v850 code in isolation and seeing it crash: $ runtest v850/allinsns.exp ... Running target unix Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target. Using /usr/share/dejagnu/config/unix.exp as generic interface file for target. Using ../../../sim/testsuite/config/default.exp as tool-and-target-specific interface file. WARNING: Assuming target board is the local machine (which is probably wrong). You may need to set your DEJAGNU environment variable. Running ../../../sim/testsuite/v850/allinsns.exp ... ERROR: tcl error sourcing ../../../sim/testsuite/v850/allinsns.exp. ERROR: tcl error code TCL LOOKUP VARNAME opt ERROR: can't read "opt": no such variable while executing "switch -regexp -- $opt { Backing up a bit, the reason for this logic in the first place is because the common sim testsuite code makes an assumption about the assembler options with cpu_option -- the option and its value are always separated by an =. This is not the case with v850. So tweak the core sim logic a bit to support omitting the = so that we can switch v850 to the standard all_machs setting and avoid opt entirely.
2021-11-16sim: testsuite: add support for $pwd replacementsMike Frysinger1-0/+1
Extend the common test framework to support $pwd replacements in settings. This allows replacing the custom cris @exedir@ with it.
2021-11-11sim: testsuite: drop sim_compile cover functionMike Frysinger1-13/+0
Most code isn't using this, and the only call site (in one cris file) can use target_compile directly. So switch it over to simplify.
2021-11-10sim: synacor: simplify test generationMike Frysinger1-7/+0
Objcopy was used to create a binary file of just the executable code since the environment requires code to based at address 0. We can accomplish the same thing with the -Ttext=0 flag, so switch to that to get rid of custom logic.
2021-04-08sim: testsuite: support exit 77 for unsupported testsMike Frysinger1-1/+3
Exit status 77 is common (including the autotools world) to indicate "skip this test". Add support for mapping that to "unsupported" as that's the closest in the dejagnu world.
2021-04-08sim: testsuite: skip tests when the port is disabledMike Frysinger1-0/+5
If the port hasn't been enabled, don't try to run its tests. Making this dynamic simplifies the test harnesses and avoids duplicating a bunch of target tuple checks.
2021-04-08sim: testsuite: calculate $arch from $subdirMike Frysinger1-10/+17
Since we require ports to use a matching subdir name in the testsuite tree, we can use that to calculate the $arch value.
2021-04-03sim: example-synacor: a simple implementation for referenceMike Frysinger1-0/+7
Provide a simple example simulator for people porting to new targets to use as a reference. This one has the advantage of being used by people and having a fun program available for it. It doesn't require a special target -- the example simulators can be built for any existing port.
2021-03-07sim: testsuite: merge into toplevel automakeMike Frysinger1-1/+1
This allows us to delete most of our custom test logic, and avoids a recursive make for minor speed up.
2021-01-15sim: testsuite: allow tests to declare expected exit statusMike Frysinger1-11/+12
Some tests want to verify they can control the exit status, and allowing any non-zero value would allow tests to silently fail: if it crashed & exited 1, or forced all non-zero to 1, then we wouldn't be able to differentiate with a test exiting with a status like 47. Extend the test harness to allow tests to declare their expected exit status that would be defined as a "pass". This requires a small tweak to the sim_run API to return the status directly, but that shouldn't be a big deal as it's only used by sim code.
2015-11-15sim: testsuite: support basic vars in flagsMike Frysinger1-0/+6
Sometimes in tests, we need supplemental files like linker scripts or board helper files. There's no way to set those flags in the tests currently and relative paths don't work (breaks out of tree builds). Update the main option parser to replace some strings on the fly. Now tests can do things like: Long term we'll want to switch the framework to use the dejagnu helpers like dg-xxx that gcc & gdb utilize. But that'll require more rework.
2015-04-13Do unset_currtarget_info ldscript for all simulator testsuites.Hans-Peter Nilsson1-0/+10
sim/testsuite: * sim-defs.exp (sim_init): Unset target ldscript here. sim/testsuite/sim/mips: * basic.exp: Don't unset target ldscript here.
2015-03-29sim; testsuite: allow tests to set no outputMike Frysinger1-1/+3
If a test doesn't write anything at all to stdout, the current test framework can't support that. Even if you put a blank output line: # output: the setup happily clobbers that with a default pass/fail string. Tweak the parsing logic so we only set the output to pass/fail when the test has no output marker.
2011-05-16sim: tests: support .S/.c filesMike Frysinger1-9/+39
Rather than requiring all sim tests to be preprocessed .s files, add support for .S and .c files so we can easily write code using a higher level language like C. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-04-26sim: unify target->subdir handling for default testsMike Frysinger1-0/+9
The testsuite subdir has a note about unifying the target->subdir logic, so do just that. The end goal here is to have `make check` work out of the box without having to delve into dejagnu internals. The target-specific logic is split out of the top level configure.ac file and into a dedicated configure.tgt similar to other subprojects (gdb and ld and etc...) with the difference that this file has to be included at the m4 level instead of the shell level. This is necessary only because autoconf requires AC_CONFIG_SUBDIRS be given a string literal and not a variable value. Then the toplevel and the testsuite configure files pull this in, the sim subdir gets expanded into testsuite/site.exp, and the default sim run code uses this info to set the sim path to the local compiled run file if it hasn't already been specified. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-01-18 * sim/cris/asm/opterr5.ms, sim/cris/asm/opterr4.ms,Hans-Peter Nilsson1-1/+3
sim/cris/asm/opterr3.ms, sim/cris/asm/bare3.ms: New tests. * lib/sim-defs.exp (run_sim_test): New option progopts.
2004-11-16Fix consistenco; it's triplets, not triplesHans-Peter Nilsson1-2/+2
2004-11-16 * lib/sim-defs.exp (run_sim_test): Support "xfail" and "kfail".Hans-Peter Nilsson1-0/+25
2004-11-16 * lib/sim-defs.exp (run_sim_test): Make multiple "output"Hans-Peter Nilsson1-0/+4
specifications concatenate, not override.
2004-10-26(sim_run): Add support for the "rawsid" protocol.Nick Clifton1-3/+10
2004-09-13* lib/sim-defs.exp (run_sim_test): Add global_as_options,DJ Delorie1-3/+16
global_ld_options, and global_sim_options to all test cases, if defined.
2004-05-12 * lib/sim-defs.exp: Remove stray semicolons.Ben Elliston1-1/+1
2004-01-23 * lib/sim-defs.exp (run_sim_test): Delete the .o and .x files if aBen Elliston1-0/+2
test passes.
2003-09-092003-09-09 Dave Brolley <brolley@redhat.com>Dave Brolley1-4/+4
* sim/frv/maddaccs.cgs: move to fr400 subdirectory. * sim/frv/msubaccs.cgs: move to fr400 subdirectory. * sim/frv/masaccs.cgs: move to fr400 subdirectory.
2001-07-312001-07-31 Ben Elliston <bje@redhat.com>Ben Elliston1-6/+6
* lib/sim-defs.exp (run_sim_test): Include a description such as "assembling" or "linking" that identifies the phase a test fails in, for easier analysis of failures.
2000-11-012000-11-01 Dave Brolley <brolley@cygnus.com>Dave Brolley1-9/+28
* lib/sim-defs.exp (run_sm_test): Correct comment. "output" and "xerror" options do not use a list of machines. Clear options from previous test case. Use "$cpu_option" to identify the machine to the assembler, if specified.
1999-08-31import gdb-1999-08-30 snapshotJason Molenda1-10/+24
1999-04-16Initial creation of sourceware repositorygdb-4_18-branchpointStan Shebs1-0/+318
1999-04-16Initial creation of sourceware repositoryStan Shebs2-296/+0
1998-06-12 * lib/sim-defs.exp (sim_run): Argument env_vals renamed to options,Doug Evans1-4/+32
which is now a list of options controlling the behaviour of sim_run.
1998-06-11(sim_compile): Tweak output text.Doug Evans1-1/+1
1998-06-01* sky test suite fixes.Frank Ch. Eigler1-14/+32
Mon Jun 1 18:54:22 1998 Frank Ch. Eigler <fche@cygnus.com> * lib/sim-defs.exp (sim_run): Add possible environment variable list to simulator run. start-sanitize-sky * sim/sky/sky-defs.tcl: Use it. * sim/sky/t-pke2.vif1out: Update to match recent word-precise tracking table change in sim/mips/sky-pke.c. * sim/sky/t-pke3.trc: Ditto. * sim/sky/t-pke4.vif0expect: Ditto. end-sanitize-sky Mon May 18 10:37:47 1998 Doug Evans <devans@canuck.cygnus.com>
1998-05-08 * lib/sim-defs.exp (sim_version): Simplify.Doug Evans1-0/+216
(sim_run): Implement. (run_sim_test): Use sim_run. (sim_compile): New proc.
1998-03-13new .Sanitize filesAngela Marie Thomas1-0/+34