From 80e4ef190e3f86e9d51ae16739baa95b4e8d71dc Mon Sep 17 00:00:00 2001 From: xengineering Date: Sat, 2 Aug 2025 13:55:15 +0200 Subject: integration: Add simple execution test This test starts the native sim firmware of iot-contact and runs it for 5 seconds. --- integration/execution_test.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 integration/execution_test.go diff --git a/integration/execution_test.go b/integration/execution_test.go new file mode 100644 index 0000000..87a7ee6 --- /dev/null +++ b/integration/execution_test.go @@ -0,0 +1,35 @@ +package integration + +import ( + "os" + "os/exec" + "testing" + "time" +) + +const ( + ENV_NATIVE_SIM_FIRMWARE = `IOT_CONTACT_NATIVE_SIM_FIRMWARE` + SIMPLE_EXECUTION_TIME_S = 5 +) + +func TestExecuteFirmware(t *testing.T) { + firmware := os.Getenv(ENV_NATIVE_SIM_FIRMWARE) + + if firmware == "" { + t.Skip("Environment variable '" + ENV_NATIVE_SIM_FIRMWARE + "' not set") + } + + cmd := exec.Command(firmware) + + err := cmd.Start() + if err != nil { + t.Fatalf("Could not start native sim firmware: %v", err) + } + + time.Sleep(SIMPLE_EXECUTION_TIME_S * time.Second) + + err = cmd.Process.Kill() + if err != nil { + t.Fatalf("Could not stop native sim firmware: %v", err) + } +} -- cgit v1.2.3-70-g09d2