From a5103f63ed484e51c5b200d0dde95548d0041b77 Mon Sep 17 00:00:00 2001 From: Chris Nisbet Date: Thu, 29 Oct 2020 19:39:15 +1300 Subject: [PATCH] halcmd: fix "tune" command locking. Added a unit test to test the various lock commands produce the expected output. --- tests/halrun-lock/README | 1 + tests/halrun-lock/expected | 28 ++++++++++++++++++++++++++++ tests/halrun-lock/halrun.hal | 14 ++++++++++++++ tests/halrun-lock/test.sh | 4 ++++ 4 files changed, 47 insertions(+) create mode 100644 tests/halrun-lock/README create mode 100644 tests/halrun-lock/expected create mode 100644 tests/halrun-lock/halrun.hal create mode 100644 tests/halrun-lock/test.sh diff --git a/tests/halrun-lock/README b/tests/halrun-lock/README new file mode 100644 index 00000000000..662031ee3cc --- /dev/null +++ b/tests/halrun-lock/README @@ -0,0 +1 @@ +Tests that the various lock commands result in the expected locking status. diff --git a/tests/halrun-lock/expected b/tests/halrun-lock/expected new file mode 100644 index 00000000000..6df356a71f9 --- /dev/null +++ b/tests/halrun-lock/expected @@ -0,0 +1,28 @@ +HAL locking status: + current lock value 0 (00) + HAL_LOCK_NONE - nothing is locked +HAL locking status: + current lock value 255 (ff) + HAL_LOCK_LOAD - loading of new components is locked + HAL_LOCK_CONFIG - link and addf is locked + HAL_LOCK_PARAMS - setting params is locked + HAL_LOCK_RUN - running/stopping HAL is locked +HAL locking status: + current lock value 0 (00) + HAL_LOCK_NONE - nothing is locked +HAL locking status: + current lock value 3 (03) + HAL_LOCK_LOAD - loading of new components is locked + HAL_LOCK_CONFIG - link and addf is locked +HAL locking status: + current lock value 0 (00) + HAL_LOCK_NONE - nothing is locked +HAL locking status: + current lock value 255 (ff) + HAL_LOCK_LOAD - loading of new components is locked + HAL_LOCK_CONFIG - link and addf is locked + HAL_LOCK_PARAMS - setting params is locked + HAL_LOCK_RUN - running/stopping HAL is locked +HAL locking status: + current lock value 0 (00) + HAL_LOCK_NONE - nothing is locked diff --git a/tests/halrun-lock/halrun.hal b/tests/halrun-lock/halrun.hal new file mode 100644 index 00000000000..569b5df363a --- /dev/null +++ b/tests/halrun-lock/halrun.hal @@ -0,0 +1,14 @@ +status +lock +status +unlock +status +lock tune +status +unlock tune +status +lock all +status +unlock all +status + diff --git a/tests/halrun-lock/test.sh b/tests/halrun-lock/test.sh new file mode 100644 index 00000000000..ee6fd8ce226 --- /dev/null +++ b/tests/halrun-lock/test.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +halrun -f halrun.hal | grep -i lock +