muter
muter copied to clipboard
Change temporary directory
Why:
projects that use resources with relative paths cannot be built
What was done:
-
New flag has been added to the configuration

-
CopyProjectToTempDirectory step was split into 2 steps: CopyProjectToTempDirectory and CreateTempDirectoryURL
-
RemoveProjectFromPreviousRun step has been added
The default steps:

@uncle-alek could you elaborate on the issue little more? it's not clear to me why adding _mutated at the end fixes it nor what really is the bug
It makes sense to me. A project may require resources outside itself, but relative to its own path, in order to build. Keeping the mutated project in the same folder as the original ensures that those relative paths will still work.
@rakaramos sorry for the poor explanation of the issue, @ZevEisenberg explained it very well. This happens with a large project with many submodules (subprojects) that reuse resources.
Should a temporary directory be kept on disk for any use? I just found the Muter output message: This directory will also serve as a backup for any XCTest logs that are generated by running your test suite.
yes @uncle-alek, we have a folder for dumping all the logs, for troubleshooting in case something goes wrong
Should a temporary directory be kept on disk for any use? I just found the Muter output message: This directory will also serve as a backup for any XCTest logs that are generated by running your test suite.
We are saving the logs at the current path
https://github.com/muter-mutation-testing/muter/blob/f24315a287e929ca92eed476f506fa983239eafc/Sources/muterCore/MutationTesting/MutationTestingIODelegate.swift#L57
If you are still seeing muter_logs on the project's directory, after muter finished, then I think it's fine!
Should a temporary directory be kept on disk for any use? I just found the Muter output message: This directory will also serve as a backup for any XCTest logs that are generated by running your test suite.
We are saving the logs at the current path
https://github.com/muter-mutation-testing/muter/blob/f24315a287e929ca92eed476f506fa983239eafc/Sources/muterCore/MutationTesting/MutationTestingIODelegate.swift#L57
If you are still seeing
muter_logson the project's directory, after muter finished, then I think it's fine!
I still see it in the project directory, but it looks like this message (This directory will also serve as a backup for any XCTest logs that are generated by running your test suite) is no longer relevant.
And this one You can find your copied project here.
@rakaramos regressions tests passed

What do you think about making this a flag/option instead of the default behavior? I'm wary of creating new files outside the project directory, especially ones that aren't in a temp folder so they won't get cleaned up on reboot. I think the utility of this change is definitely valid, but also probably not that common of a need.
@ZevEisenberg i'm thinking about the name of this flag and I think the user of the muter could be confused if he sees something like useProjectDirectoryForMutation. Should the flag be part of the conf.json file?
What if pass the path to copy the project in the configuration? Default will be the temp one.
I agree with adding it to the json config, seems to be more of a project configuration that won't change than something users would tweak on each run
mutateFilesInSiblingOfProjevtFolder maybe? And just a Boolean - probably don't need to pass a path unless we get more use cases that people actually need.
But also, I think I'm used to CLIs allowing both config file and command line flags, just for flexibility.
I added the flag to the config. An additional step is also provided to clean up the temp folder if any step throws an error.
What if the user needs to keep the temp folder around to debug the failure?
I think in this case, the temporary folder can be saved and deleted the next time you start the muter. But the user will have to add the folder name to the .gitignore file.
Current steps:
...
CopyProjectToTempDirectory
...
RemoveTempDirectory
After:
...
RemoveTempDirectory
CopyProjectToTempDirectory
...
@rakaramos @ZevEisenberg sorry forgot to mention all regression tests passed, could you double check the code?
@rakaramos @ZevEisenberg sorry to bother you again, just want to remind you of the opened PR :)