Skip to content

Conversation

@tschroff
Copy link
Contributor

@tschroff tschroff commented Apr 12, 2021

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. Otherwise nil 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

@ekot1 ekot1 merged commit e017657 into DelphiCodeCoverage:master Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants