From 8e92b0f819acaa74b25d472b78b25c51d71d0c5f Mon Sep 17 00:00:00 2001 From: Compot Developer Date: Wed, 4 Nov 2026 14:23:14 +0000 Subject: [PATCH 1/3] Tests: the Macronix QE check of -t looks at the exit code It looked only for the word PROTECTED in the output, so a -t that failed for another reason passed it. [skip ci] --- tests/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run.sh b/tests/run.sh index 23c4fe5..1ae6b52 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -73,7 +73,7 @@ $B -t -a 0x8123 | grep -q 'block 0x8000 + 0x1000' && echo "ok -a 0x8123: the t 2 "-t, protected by BP bits" MS_SR=1c0000 MS_PROTECT=1 $B -t t 2 "-t Macronix, BP3 alone protects" MS_MACRONIX=1 MS_SR=20ff07 MS_PROTECT=1 $B -t MS_MACRONIX=1 MS_SR=20ff07 $B -t | grep -q 'SR1 = 0x20: BP = 8' && echo "ok -t Macronix names BP3" || { echo "FAIL -t Macronix BP3"; fail=1; } -MS_MACRONIX=1 MS_SR=40ff07 $B -t | grep -q 'PROTECTED' && { echo "FAIL -t Macronix QE taken for protection"; fail=1; } || echo "ok -t Macronix: QE is not a protection, ff and 07 are not read as registers" +t 0 "-t Macronix: QE is not a protection, ff and 07 are not read as registers" MS_MACRONIX=1 MS_SR=40ff07 $B -t cp before.img chip.img; MS_SR=1c0000 $B -t | grep -q 'PROTECTED, the registers protect part.*-u' && MS_SR=1c0000 $B -t | grep -q 'BP = 7, TB = 0' && cmp -s chip.img before.img && echo "ok says PROTECTED, the bits and -u, and erases nothing" || { echo "FAIL -t protected"; fail=1; } t 2 "-t, nothing changes, no bits set" MS_PROTECT=1 $B -t MS_PROTECT=1 $B -t | grep -q 'no register bit says so' && echo "ok a block that keeps its data with no bit set: told apart" || { echo "FAIL -t hidden protection"; fail=1; } From 9c6c4318fd7cde713d2b49d5e5f44ce4772de355 Mon Sep 17 00:00:00 2001 From: Compot Developer Date: Wed, 4 Nov 2026 15:27:49 +0000 Subject: [PATCH 2/3] CI run for the merge From 90e1f76d5296838f3bf32b4df416a1aa4bbcf31d Mon Sep 17 00:00:00 2001 From: Compot Developer Date: Wed, 4 Nov 2026 15:30:10 +0000 Subject: [PATCH 3/3] Tests: -t on Macronix with a failed erase exits 1 --- tests/run.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/run.sh b/tests/run.sh index 1ae6b52..9ae4071 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -74,6 +74,7 @@ t 2 "-t, protected by BP bits" MS_SR=1c0000 MS_PROTECT=1 $B -t t 2 "-t Macronix, BP3 alone protects" MS_MACRONIX=1 MS_SR=20ff07 MS_PROTECT=1 $B -t MS_MACRONIX=1 MS_SR=20ff07 $B -t | grep -q 'SR1 = 0x20: BP = 8' && echo "ok -t Macronix names BP3" || { echo "FAIL -t Macronix BP3"; fail=1; } t 0 "-t Macronix: QE is not a protection, ff and 07 are not read as registers" MS_MACRONIX=1 MS_SR=40ff07 $B -t +t 1 "-t Macronix: an erase that fails is a failure, not protection" MS_MACRONIX=1 MS_SR=40ff07 MS_FAIL=erase $B -t cp before.img chip.img; MS_SR=1c0000 $B -t | grep -q 'PROTECTED, the registers protect part.*-u' && MS_SR=1c0000 $B -t | grep -q 'BP = 7, TB = 0' && cmp -s chip.img before.img && echo "ok says PROTECTED, the bits and -u, and erases nothing" || { echo "FAIL -t protected"; fail=1; } t 2 "-t, nothing changes, no bits set" MS_PROTECT=1 $B -t MS_PROTECT=1 $B -t | grep -q 'no register bit says so' && echo "ok a block that keeps its data with no bit set: told apart" || { echo "FAIL -t hidden protection"; fail=1; }