New option to use the test executable's path as working directory #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
we have found that some of our unittests load their test-data files by using constant (hard-coded), relative paths.
This works just fine (in regards to the test executable finding its files) when running those tests from within the Delphi IDE, as the working directory is the path of the executable in this case. Also, when the tests are run directly by our Jenkins build server, the current working directory is set explixitely to be the executable's path by our build scripts. So this works fine as well.
When running our tests with Delphi Code Coverage we do not pass the executable (-e) but the project file (-dproj) and in this case we don't know the path of the test executable. So it's a little bit harder to set the required working directory when/before calling the Delphi Code Coverage executable.
Although our unittests could be changed to determine the proper absolute paths by themselves (which we partially did) and this way successfully find their test-data files, we also thought that introducing an additional option '-twd' for Delphi Code Coverage might be a good idea in addition and in general. If this switch is given, Delphi Code Coverage will call
CreateProcess
by passing the test executable's path as working directory. Otherwisenil
will be passed, like before.I thought that this might be a reasonable feature and wanted to provide the changes via this pull request.
Please feel free to reject it, or to accept it while fine-tuning or renaming things. I did my best to stick to the current format style and existing names and I hope that I adjusted all places (source code as well as documentation), so that it is complete.
Also, I fixed the description of '-tec' in the usage (probably was a little copy-paste accident).
Thanks and cheers,
Thorsten