Odin icon indicating copy to clipboard operation
Odin copied to clipboard

allow `-out` with `odin test` for easier test debugging

Open IanLilleyT opened this issue 3 years ago • 2 comments

Summary

When debugging tests I have to point the debugger at

{root}/source/.exe (the default test executable location)

instead of a more sane custom path like

{root}/test.exe

Allowing -out with odin test would make this possible, but I'm not sure if it's in the spirit of odin test, seeing that it was disallowed in the original commit (https://github.com/odin-lang/Odin/commit/2bd0fd932a4eb1c2e6bc8702450c230186bb3c44). The fix is to remove &~ Command_test from here: https://github.com/odin-lang/Odin/blob/81e3b64ecda857458b8e0762bdf6156cdaa1cb74/src/main.cpp#L750

Side note, one awkward thing about debugging tests is they get run twice: first when calling odin test, which builds and runs the test executable, and again when debugging. To get around this there would need to be a odin test-build and odin test-run similar to odin build and odin run. Right now it's not a big deal and there's benefits to having a cleaner CLI with just odin test. Anyway, that's a separate matter.

Report

Odin: dev-2022-09:0bc660c7
OS:   Windows 11 Professional (version: 21H2), build 22000.856
CPU:  Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
RAM:  32605 MiB

IanLilleyT avatar Sep 08 '22 16:09 IanLilleyT

I'd prefer odin test <package> -build-only to splitting it up into two verbs, odin test-build & odin test-run. Too much noise for a rare use case.

Kelimion avatar Sep 08 '22 16:09 Kelimion

And while we're at it, we could add a odin test <package> -keep-test-executable to keep the executable after running the test, with it being deleted by default.

Kelimion avatar Sep 08 '22 16:09 Kelimion