summaryrefslogtreecommitdiff
path: root/integration/execution_test.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-08-10 21:16:07 +0200
committerxengineering <me@xengineering.eu>2025-08-10 21:16:07 +0200
commitc53fee51f01db0d803a803b380d5f476278ea5fd (patch)
tree79a50aa8ac0a30ad41819ad1315085614cece582 /integration/execution_test.go
parent0b45492bb3e0da4c1956b25bdc2e3f7c5f3f887b (diff)
downloadiot-contact-go-c53fee51f01db0d803a803b380d5f476278ea5fd.tar
iot-contact-go-c53fee51f01db0d803a803b380d5f476278ea5fd.tar.zst
iot-contact-go-c53fee51f01db0d803a803b380d5f476278ea5fd.zip
integration: Add tempdir()HEADmain
This utility function centralizes the creation and error handling for temporary test directories to run native sim firmware or scripts to start a real DUT (device under test).
Diffstat (limited to 'integration/execution_test.go')
-rw-r--r--integration/execution_test.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/integration/execution_test.go b/integration/execution_test.go
index 82fa2b9..3492fa3 100644
--- a/integration/execution_test.go
+++ b/integration/execution_test.go
@@ -22,16 +22,13 @@ func TestExecuteDUT(t *testing.T) {
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")
- }
+ dir := tempdir(t)
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)
}