Skip to content

Comments

Route all tests through d_do_test#8129

Merged
dlang-bot merged 1 commit intodlang:masterfrom
marler8997:commonTestEntry
Apr 7, 2018
Merged

Route all tests through d_do_test#8129
dlang-bot merged 1 commit intodlang:masterfrom
marler8997:commonTestEntry

Conversation

@marler8997
Copy link
Contributor

@marler8997 marler8997 commented Apr 4, 2018

Provides a common entry point for all tests to perform common setup/operations. Also simplifies the interface to run a test (resulting in a simplified Makefile).

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @marler8997! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + dmd#8129"

string test_name = args[2];
string test_extension = args[3];
auto test_file = args[1];
auto result = matchFirst(test_file, `^([^/^\\]+)[/\\]([^\.]+)\.(.+)$`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be RegExp? Doesn't baseName + stripExtension work too?

{
auto process = spawnProcess(["./tools/sh_do_test.sh".replace("/", envData.sep),
input_dir, test_name]);
return process.wait();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not std.process.execute if you wait anyhow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not capturing stdout/stderr

@marler8997 marler8997 force-pushed the commonTestEntry branch 3 times, most recently from e171b64 to 3cdbcab Compare April 4, 2018 15:26
Copy link
Contributor

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

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

Nice & one step closer to making it easier for people on Windows to run the testsuite :)

auto test_file = args[1];
string input_dir = test_file.dirName;
string test_base_name = test_file.baseName;
string test_name = test_base_name.stripExtension();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit inconsistent here. All three are functions ;-)
(by "your majority vote" maybe adapt stripExtension?)

if (test_base_name.extension() == ".sh")
{
auto process = spawnShell(format("%s %s %s",
"./tools/sh_do_test.sh".replace("/", envData.sep), input_dir, test_name));
Copy link
Contributor

Choose a reason for hiding this comment

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

"tools".buildPath("sh_do_test.sh") ?

@wilzbach wilzbach added the Merge:72h no objection -> merge The PR will be merged if there are no objections raised. label Apr 5, 2018
@wilzbach
Copy link
Contributor

wilzbach commented Apr 5, 2018

C:\projects\dmd\test\tools\sh_do_test.sh: line 17: /c/projects/dmd/test/exported_vars.sh: No such file or directory
C:\projects\dmd\test\tools\sh_do_test.sh: line 17: /c/projects/dmd/test/exported_vars.sh: No such file or directory
make[1]: *** [Makefile:129: test_results/runnable/test35.sh.out] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:129: test_results/runnable/test44.sh.out] Error 1
 ... runnable\ifti.d                  (-O -inline -g)
make: *** [Makefile:152: start_runnable_tests] Error 2

@ibuclaw ibuclaw removed the Merge:72h no objection -> merge The PR will be merged if there are no objections raised. label Apr 5, 2018
@ibuclaw
Copy link
Member

ibuclaw commented Apr 5, 2018

Can't merge if there's failing tests, so that will need to be addressed first. Other than that, so far seems reasonable.

@marler8997
Copy link
Contributor Author

Closing and reopening to see if the appveryor failure is a red herring...

@marler8997 marler8997 closed this Apr 6, 2018
@marler8997 marler8997 reopened this Apr 6, 2018
@marler8997 marler8997 force-pushed the commonTestEntry branch 2 times, most recently from 60568b9 to 299a8e1 Compare April 6, 2018 02:28
@wilzbach
Copy link
Contributor

wilzbach commented Apr 6, 2018

FYI I already restarted it twice before posting the error, so I think the error is a permanent one. It probably has something to do with AppVeyor's setup of Cygwin.

exit 1
fi

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you remove this?
This allows the script to be called from anywhere (in the future at least)

Copy link
Contributor Author

@marler8997 marler8997 Apr 6, 2018

Choose a reason for hiding this comment

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

I think this might be why AppVeyor is failing...I"ve removed it to see if it fixes the issue... I know removing it is more "brittle". If this works, maybe I should redefined it to something like ${TEST_DIR}/../tools? I don't like it as much. The fact that Bash script files don't have an easy way to get their own directory is such a pain. This is one of the only things that BATCH has over Bash :) (%~dp0....done)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding bash to the beginning of the spawnShell command seems to have fixed the AppVeyor issue.

@marler8997
Copy link
Contributor Author

Yeah, I've been seeing a bunch of different errors on AppVeyor recently in other PRs but this one is consistent. Looks like it might be the definition of DIR in sh_do_test.sh might not be working for the AppVeyor...on to trial/error

Provides a common entry point for all tests to perform common setup/operations.  Also simplifies the interface to run a test.
@wilzbach wilzbach added the Merge:72h no objection -> merge The PR will be merged if there are no objections raised. label Apr 6, 2018
@dlang-bot dlang-bot merged commit a93a7ff into dlang:master Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Infrastructure:Build System Merge:auto-merge Merge:72h no objection -> merge The PR will be merged if there are no objections raised.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants