Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .circleci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ check_clean_git()
# sanitycheck for the run_individual_tests script
check_run_individual()
{
./test/run_individual_tests test/runnable/template2962.d ./test/compilable/test14275.d
local build_path=generated/linux/release/$MODEL
"${build_path}/dmd" -i -run ./test/run_individual_tests.d test/runnable/template2962.d ./test/compilable/test14275.d
}

codecov()
Expand Down
8 changes: 4 additions & 4 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ make -j10 run_runnable_tests
### Run only an individual test

```sh
./run_individual_tests fail_compilation/diag10089.d
./run_individual_tests.d fail_compilation/diag10089.d
```

Multiple arguments are supported too.
You can use `./run_individual_tests` to quickly run a custom subset of tests.
You can use `./run_individual_tests.d` to quickly run a custom subset of tests.
For example, all diagnostic tests in `fail_compilation`:

```sh
./run_individual_tests fail_compilation/diag*.d
./run_individual_tests.d fail_compilation/diag*.d
```

### Automatically update the `TEST_OUTPUT` segments
Expand All @@ -58,7 +58,7 @@ AUTO_UPDATE=1 make run_fail_compilation_tests -j10
Updating the `TEST_OUTPUT` can also be done for a custom subset of tests:

```sh
AUTO_UPDATE=1 ./run_individual_tests fail_compilation/diag*.d
AUTO_UPDATE=1 ./run_individual_tests.d fail_compilation/diag*.d
```

Note:
Expand Down
41 changes: 0 additions & 41 deletions test/run_individual_tests

This file was deleted.

44 changes: 44 additions & 0 deletions test/run_individual_tests.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env rdmd
/**
Allows running tests individually

Usage:
./run_individual_tests.d <test-file>...

Example:
./run_individual_tests.d runnable/template2962.d fail_compilation/fail282.d

See the README.md for all available test targets
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe drop this header in favor of the built-in help and README.md?

*/

void main(string[] args)
{
import std.algorithm, std.conv, std.format, std.getopt, std.path, std.process, std.range, std.stdio, std.string;
import std.parallelism : totalCPUs;

const scriptDir = __FILE_FULL_PATH__.dirName;
int jobs = totalCPUs;
auto res = getopt(args,
"j|jobs", "Specifies the number of jobs (commands) to run simultaneously (default: %d)".format(totalCPUs), &jobs,
);
if (res.helpWanted || args.length < 2)
{
defaultGetoptPrinter(`./run_individual_tests.d <test-file>...

Examples:

./run_individual_tests.d runnable/template2962.d
./run_individual_tests.d runnable/template2962.d fail_compilation/fail282.d

Options:
`, res.options);
"\nSee the README.md for a more in-depth explanation of the test-runner.".writeln;
return;
}

auto makeArguments = ["make", "--jobs=".text(jobs)]
.chain(args.dropOne.map!(f =>
format!"test_results/%s/%s.out"(f.absolutePath.dirName.baseName, f.baseName)))
.array;
spawnProcess(makeArguments, null, Config.none, scriptDir).wait;
}