Skip to contentSkip to conversation

tests/qtest/test-hmp: Improve the check for verbose mode

PATCH Applied Thomas Huth 3 participants 3 messages Jan 9, 2023 – Jan 16, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/qtest/test-hmp: Improve the check for verbose mode

Running the test-hmp with V=2 up to V=9 runs the test in verbose mode, but running for example with V=10 falls back to non-verbose mode ... Improve this oddity by properly treating the argument as a number.

---
 tests/qtest/test-hmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/test-hmp.c +1 -1
index f8b22abe4c..b4a920df89 100644
@@ -151,7 +151,7 @@ int main(int argc, char **argv)
 {
     char *v_env = getenv("V");
 
-    if (v_env && *v_env >= '2') {
+    if (v_env && atoi(v_env) >= 2) {
         verbose = true;
     }
 
Signature · 1 line
2.31.1
#2 lore raw
In reply to Thomas Huth

Le 09/01/2023 à 11:13, Thomas Huth a écrit :

Quoted 14 lines

Running the test-hmp with V=2 up to V=9 runs the test in verbose mode, but running for example with V=10 falls back to non-verbose mode ... Improve this oddity by properly treating the argument as a number.

---
  tests/qtest/test-hmp.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/test-hmp.c +0 -0
index f8b22abe4c..b4a920df89 100644

tests/qtest/test-hmp.c int main(int argc, char **argv) · line 157

Quoted 8 lines
tests/qtest/test-hmp.c +1 -1
@@ -151,7 +151,7 @@ int main(int argc, char **argv)
  {
      char *v_env = getenv("V");
 
-    if (v_env && *v_env >= '2') {
+    if (v_env && atoi(v_env) >= 2) {
          verbose = true;
      }
 

Applied to my trivial-patches branch.

Thanks,
Laurent