Commit graph

71 commits

Author SHA1 Message Date
Martin Kinkelin
b3bf04683e CI: Add GitHub Actions workflow 2023-12-17 23:28:26 +01:00
Geod24
5e0317a4e8 Fix issue 13345 - Add argument support to rdmd --eval 2020-06-06 01:47:42 +09:00
Vladimir Panteleev
a29876673a
rdmd_test: Don't attempt to run Makefile test when Make is too old
Allows running most of the rdmd test suite even on systems with old
GNU Make, such as Travis CI.
2018-04-10 21:28:01 +00:00
Vladimir Panteleev
980a3eec38
rdmd_test: Replace use of assert with enforce
Avoid any potential false positives resulting from rdmd_test being
accidentally built with -release.

Avoiding this situation is paramount, with the alternative being a
clunky runtime test to detect that rdmd_test was built with -release,
so this solution is preferable, even considering the semantic loss of
the distinction between assert/enforce and their existing usage.
2018-04-10 17:01:08 +00:00
Vladimir Panteleev
20b96adfad
rdmd_test: Properly escape localDMD path in test
Windows uses backslashes for string separators, which are rendered as
escaped in rdmd's --chatty output. Mirror this behavior to correctly
run this test on Windows, as well as other situations when the path
contains characters that would be escaped by std.format's "DSON"
formatting.
2018-04-10 16:42:59 +00:00
Vladimir Panteleev
0b9872ce2d
rdmd_test: Use empty file for the dummy DMD program
Use an empty file (instead of one containing a dummy string) to avoid
a GUI pop-up, which would otherwise need to be dismissed by an
interactive user. An empty file will just cause a "%s is not a valid
Win32 application" exception, which is similar enough to the Posix
behavior and handled properly by rdmd and the test suite.
2018-04-10 16:41:12 +00:00
Vladimir Panteleev
5509f96e59
rdmd_test: Apply extension to localDMD in runFallbackTest
Mirror the rdmd fix from the previous commit and apply the proper
executable file extension on Windows.
2018-04-10 16:40:02 +00:00
Vladimir Panteleev
8997c5765c
rdmd_test: Don't attempt to run Makefile test on Windows
Almost certainly, the `make` executable in PATH is not going to be GNU
Make, but DigitalMars Make instead.
2018-04-10 16:17:11 +00:00
Vladimir Panteleev
f9a7408119
rdmd_test: Include model switches where they were previously omitted
Fixes some tests using the wrong model.

Also fixes running the test suite for DMD configurations supporting
just one model, which is not the default DMD model (e.g. those built
by Digger on Windows).
2018-04-10 16:15:52 +00:00
Vladimir Panteleev
cdba7d3deb
rdmd_test: Fix help text test on Windows
Convert line endings before attempting to split by them.
2018-04-10 16:15:16 +00:00
Superstar64
e88c44d181 rdmd: support --eval <arg> to make it Makefile friendly 2018-03-26 03:13:21 +02:00
Joseph Rushton Wakeling
348610de2d rdmd: fix parsing of -o- and -op command-line flags
By checking only `value[0]`, the `dashOh` callback used to parse `-o...`
flags would give false positives (e.g. for `-o-foo` or `-opbar`).  This
patch fixes the discrepancy by requiring exact comparison to `value`.

A few test cases have been added to `rdmd_test` to cover these failures.

Thanks to @CyberShadow for spotting the bug and proposing the fix.
2018-03-25 19:35:14 +02:00
Joseph Rushton Wakeling
8f84fcda79 rdmd: support -of=... and -od=... flags as well as -of... and -od...
This fixes a discrepancy between `rdmd` and `dmd` in terms of the output
flags they support: `dmd` now requests `-of=...` and `-od=...` in help
output but still supports the old `-of...` and `-od...` style, while
`rdmd` was still supporting only the older variant.

Thanks to @CyberShadow for suggesting the `skipOver`-based solution.

Extra test cases have been added to `rdmd_test` to cover this, although
the way this has been done is a little bit cheeky (it turns out the only
place where `-of` and `-od` are really tested rigorously is in tests for
the case where the output file is a library in a subdirectory).  At some
point it would be a good idea to add some more rigorous test cases for
the `-o...` flags, but in the short term the tests added in this patch
should validate the changes to `rdmd` itself.
2018-03-25 19:33:19 +02:00
The Dlang Bot
cf1124afcf
Merge pull request #337 from marler8997/rdmdTestVerifyDefaultCompiler
Verify default compiler in help text matches given default compiler
merged-on-behalf-of: Vladimir Panteleev <github@thecybershadow.net>
2018-03-20 02:27:03 +01:00
Jonathan Marler
0aeb69a84b Verify default compiler in help text matches given default compiler 2018-03-19 07:37:44 -06:00
Jonathan Marler
2995c873ae Since --rdmd is required, made it a "non-option" argument instead of an "option that is [REQUIRED]"
Non-option arguments are more conventional than "required options".
2018-03-19 07:03:48 -06:00
The Dlang Bot
9a03b14dd9
Merge pull request #333 from marler8997/rdmdRelativeCompilers
support relative compiler filenames in rdmd_test
merged-on-behalf-of: Vladimir Panteleev <github@thecybershadow.net>
2018-03-19 13:07:44 +01:00
Jonathan Marler
328a545e59 Split compiler agnostic tests so they are only run once instead of once per compiler 2018-03-18 20:41:00 -06:00
Jonathan Marler
6747242c1a support relative compiler filenames in rdmd_test 2018-03-18 20:36:09 -06:00
Joseph Rushton Wakeling
4b6ae49f09 rdmd_test: rewrite to use externally-specifed rdmd executable
One key problem of the old `rdmd_test` was that it built its own rdmd
instance to test.  This meant that technically, it was never actually
run against the rdmd executable generated in the regular tools build.

This rewrite fixes this by repurposing the `--rdmd` flag of `rdmd_test`
to require not a path to `rdmd.d` but a path to the rdmd executable for
which the test suite should be run.  The provided executable is not used
directly, but is copied into a temporary directory: this is necessary in
order to run the fallback test, which involves copying a dummy compiler
into the same directory as the tested rdmd executable.

The `--compiler` flag has been removed (since `rdmd_test` no longer uses
it to build rdmd), but a new `--rdmd-default-compiler` flag is required
in order to specify the name of the default compiler for by the tested
rdmd.  This is needed in order to carry out the fallback compiler test,
which will fail if the provided name does not match that of the default
compiler used by the rdmd executable.

The `test_rdmd` target in `posix.mak` has been reworked to use the new
`--rdmd` and `--rdmd-default-compiler` flags.  By default these will be
invoked with the generated `rdmd` instance and the name of the compiler
used to build it, but these choices can be customized respectively with
the new `RDMD_TEST_EXECUTABLE` and `RDMD_TEST_DEFAULT_COMPILER` make
variables.

This should ensure that the rdmd instance generated by the regular build
is properly tested, while allowing `rdmd_test` to be used with arbitrary
`rdmd` instances if any developer should wish to do so.

Top-level module documentation has been tweaked to reflect the new flags
and intended usage, and help information has been added to the `getopt`
call, which will be output if the `-h|--help` flag is used, or if the
user fails to supply the required `--rdmd` or `--rdmd-default-compiler`
flags.
2018-03-13 22:56:42 +01:00
Joseph Rushton Wakeling
632d6a4c84 rdmd_test: clean up temporary rdmdApp on exit
There is no need for `rdmd_test` to manually remove any pre-existing
`/tmp/rdmd_app_`, since  we are going to overwrite it anyway, but it
is good housekeeping to clean it up on exit.
2018-03-13 22:06:01 +01:00
Joseph Rushton Wakeling
e25b427175 Add gdc/gdmd to compilers tested by Travis with rdmd_test
This patch updates travis.sh to install GDC and to include the DMD-alike
`gdmd` compiler frontend among the `RDMD_TEST_COMPILERS`.

Since GDC does not yet implement `pragma(lib)`, the `rdmd_test` case for
this has been disabled for the case where `gdmd` is the test compiler
(see: https://issues.dlang.org/show_bug.cgi?id=18421).  This workaround
reflects the fact that the test is of the correctness in how `rdmd` uses
a D compiler with `pragma(lib)` support, rather than of `pragma(lib)` in
itself.  The constraint can be removed once GDC supports `pragma(lib)`.
2018-02-11 15:24:49 +01:00
Joseph Rushton Wakeling
da1fdabe6a Rename compiler parameter of rdmd_test main() to buildCompiler
This is a little bit bikesheddy but helps to emphasize the distinction
between the compiler used to build rdmd, and the compiler(s) invoked by
rdmd when running the test suite.

Note that the `--compiler` flag of `rdmd_test` has been left unchanged
so as not to risk breaking changes for users.
2018-01-21 23:43:40 +01:00
Joseph Rushton Wakeling
157f48006a Add optional --test-compilers flag to rdmd_test
This new flag can be used to specify the list of different compilers for
`rdmd` to invoke when running the test suite.  This can be provided as a
single compiler name, or as a comma-separated list, e.g.

    --test-compilers=dmd,gdmd,ldmd2

The complete test suite will be run for each of the specified compilers.
If the flag is not supplied, then the test suite will be run for the
same compiler as was used to build `rdmd` (as specified by `rdmd_test`'s
`--compiler` flag).

The test for the fallback to default compiler is still invoked only with
respect to the build compiler, since by its very nature this involves a
search for only the one compiler name (determed when `rdmd` is built).
2018-01-21 23:40:51 +01:00
Joseph Rushton Wakeling
32795573ba Make rdmdApp, compiler and model local parameters of rdmd_test main()
This makes it easier to ensure that the test suite can be run for many
different choices of these parameters.

The `verbose` parameter has been left as global because it seems less
likely that this might need to be customizable for different runs of the
test suite.
2018-01-21 23:37:35 +01:00
Joseph Rushton Wakeling
47befba188 Pass rdmdApp, compiler and model to test-runner functions in rdmd_test
This should allow the test suites to be run for multiple different rdmd,
compiler and model choices, and reduce dependencies on global variables.
2018-01-21 23:37:28 +01:00
Joseph Rushton Wakeling
5b43e7ac7d Add rdmdArguments helper function to rdmd_test
The existing rdmd_test script assumes that the compiler invoked by rdmd
when running tests is the same as the compiler used to build rdmd, and
that it targets the same build model.  This helper function should make
it easier to construct tests that use different compiler and/or model
settings.
2018-01-21 23:36:20 +01:00
Joseph Rushton Wakeling
95a6612ed6 Break out compiler fallback test into separate function of rdmd_test
If no explicit `--compiler` flag is passed, `rdmd` should first search
for its default compiler (determined by the compiler used to build it)
in the same directory that it itself lives in.

The test of this behaviour is unique inasmuch as, unlike all other tests
implemented by `rdmd_test`, it alone explicitly involves a case where
`rdmd` is searching for a single compiler name.  It must therefore be
separated out from all the other tests if we want to be able to rework
them to run with multiple different compilers (which clearly requires
use of the `--compiler` flag).

The new `runFallbackTest` function has been implemented so as to avoid
having any dependencies on global state, since this will simplify future
changes required by multi-compiler tests.
2018-01-21 23:16:17 +01:00
Joseph Rushton Wakeling
55b9607f73 Rework {model,compiler}Switch helper functions in rdmd_test
The original versions of these functions assume a single, global choice
for compiler and model.  By requiring the compiler or model choice to be
passed as input we can more readily rework the rest of the test suite to
test rdmd with different compiler or model choices.
2018-01-21 20:14:20 +01:00
Jonathan Marler
d337ac49d3 Make rdmd_test.d work with relative --compiler binary
Also added the -v|--verbose option.
2017-12-17 23:51:53 -07:00
Joakim
f7e6f4ed92 Fix Issue 11997 - rdmd should search it's binary path for the compiler 2017-07-16 16:26:43 +05:30
Sebastian Wilzbach
6dee85894a Add modelSwitch to rdmd_test 2017-07-05 00:24:37 +02:00
Sebastian Wilzbach
ff92a74ea2 Remove invalid assert in rdmd_test 2017-07-04 22:51:13 +02:00
Sebastian Wilzbach
245187c7b5 Make scripts executable + runnable 2017-07-03 02:09:29 +02:00
anonymous
5ffca7b0e0 fix issue 17198 - rdmd does not recompile when --extra-file is added 2017-02-20 15:23:24 +01:00
Martin Nowak
61a9851fc0 Merge remote-tracking branch 'upstream/stable' into merge_stable
# Conflicts:
#	rdmd.d
#	rdmd_test.d
2017-01-07 01:37:16 +01:00
Vladimir Panteleev
55dae103cd rdmd_test: Fix indentation 2016-12-17 19:37:07 +00:00
Vladimir Panteleev
dc92811999 rdmd_test: Use the Windows sleep workaround only on Windows 2016-12-17 19:36:27 +00:00
Vladimir Panteleev
9be1e23e10 Use correct default output file extension when using -c 2016-12-17 16:00:40 +00:00
Vladimir Panteleev
a875b5451b Assume --build-only if -c or -lib is given 2016-12-17 16:00:40 +00:00
Vladimir Panteleev
a9aba0067c Fix Issue 16978 - [REG2.072.0] pragma(lib) is broken with rdmd
The actual fix was done by the revert. This simply adds a test.
2016-12-17 16:00:40 +00:00
Vladimir Panteleev
2ec57f8e51 Filter out -lib with -o-, to avoid creating an empty library file 2016-12-17 16:00:40 +00:00
Vladimir Panteleev
b6ec807712 Fix Issue 16962 - rdmd --build-only --force -c main.d fails: ./main: No such file or directory
The actual fix was done by the revert. This simply adds a test.
2016-12-17 16:00:40 +00:00
Vladimir Panteleev
e245e29d8b Fix Issue 14296 - RDMD fails at building a lib when the source is in a subdir 2016-12-17 16:00:40 +00:00
Vladimir Panteleev
ea3c967c72 rdmd_test: Refactor out a temporary directory helper 2016-12-17 16:00:39 +00:00
anonymous
2026a509e6 fix issue 16966 - rdmd: AssertError@rdmd.d(489): should have been created by compileRootAndGetDeps 2016-12-11 17:17:12 +01:00
Vladimir Panteleev
ab36aa5bda rdmd: Add --include switch 2016-04-23 13:23:13 +00:00
Vladimir Panteleev
cf6139e61a rdmd: Use -d with --loop/--eval to silence std.stream warnings
Fixes issue 15175
2015-10-07 13:08:12 +00:00
Vladimir Panteleev
df8e39d834 rdmd: Add --tmpdir switch as per man page
Fixes issue 15174
2015-10-07 12:32:20 +00:00
Vladimir Panteleev
47faba29cb fix Issue 15031 - rdmd should force rebuild when --compiler changes 2015-09-11 14:51:46 +00:00