diff options
| author | xengineering <me@xengineering.eu> | 2025-08-10 20:28:12 +0200 |
|---|---|---|
| committer | xengineering <me@xengineering.eu> | 2025-08-10 20:28:12 +0200 |
| commit | 98e2c59233f5d590bfc888f5b49a8b9876473f08 (patch) | |
| tree | 19b7796c2c0a8435e6c1bae2cdef2db7b955353c /integration | |
| parent | 82e576c77a6512e402b9e732b8a0503a22a0cfa0 (diff) | |
| download | iot-contact-go-98e2c59233f5d590bfc888f5b49a8b9876473f08.tar iot-contact-go-98e2c59233f5d590bfc888f5b49a8b9876473f08.tar.zst iot-contact-go-98e2c59233f5d590bfc888f5b49a8b9876473f08.zip | |
integration: Use temporary directory for tests
This removes the problem that the native sim firmware places a
`flash.bin` in the source tree of the integration test which influences
following tests.
Diffstat (limited to 'integration')
| -rw-r--r-- | integration/execution_test.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/integration/execution_test.go b/integration/execution_test.go index dad73e2..d1e94b7 100644 --- a/integration/execution_test.go +++ b/integration/execution_test.go @@ -18,14 +18,20 @@ const ( func TestExecuteFirmware(t *testing.T) { firmware := os.Getenv(ENV_NATIVE_SIM_FIRMWARE) - if firmware == "" { t.Skip("Environment variable '" + ENV_NATIVE_SIM_FIRMWARE + "' not set") } + dir, err := os.MkdirTemp("", "iot-contact-go-*") + if err != nil { + t.Skip("Could not create temporary directory") + } + defer os.RemoveAll(dir) + cmd := exec.Command(firmware) + cmd.Dir = dir - err := cmd.Start() + err = cmd.Start() if err != nil { t.Fatalf("Could not start native sim firmware: %v", err) } |
