Use "" instead of '' to quote commands as the command contains expandable
variables.

I also found that most of the test cases are not working as intended.
Most of the test commands are like "mount ... >/dev/null 2>&1 && <do
something> && umount", so there is no visible output when mount succeeds or
fails, and the "testing" macro doesn't check return code, so the testcases
always passes no matter what. These test cases should be strengthened,
thoughts?
-- 

Yi-yo Chiang
Software Engineer
[email protected]
From 33ab63261b2a0292c02fc495242e7bc58acd010e Mon Sep 17 00:00:00 2001
From: Yo Chiang <[email protected]>
Date: Mon, 1 Feb 2021 20:33:54 +0800
Subject: [PATCH 1/2] Fix mount.test command string quoting

Use "" instead of '' to quote command as the command contains expandable
variables.

Change-Id: Iaa8825e56243b369199588cbf6e47a1aba985804
---
 tests/mount.test | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/mount.test b/tests/mount.test
index 19ba5654..4f7a667f 100644
--- a/tests/mount.test
+++ b/tests/mount.test
@@ -47,8 +47,8 @@ testing "-w $tmp_b_fs /mnt (write_only mode)" \
    sleep 1 && umount /mnt && ! test -e /mnt/testDir" "" "" ""
 reCreateTmpFs
 testing "-rw $tmp_b_fs /mnt (read_write mode)" \
-  'mount -rw $tmp_b_fs /mnt >/dev/null && mkdir /mnt/testDir && \
-   sleep 1 && ! test -e /mnt/testDir && umount /mnt' "" "" ""
+  "mount -rw $tmp_b_fs /mnt >/dev/null && mkdir /mnt/testDir && \
+   sleep 1 && ! test -e /mnt/testDir && umount /mnt" "" "" ""
 reCreateTmpFs
 testing "$tmp_b_fs /mnt -t fs_type" \
   "mount $tmp_b_fs /mnt -t $tmp_b_fs_type >/dev/null 2>&1 &&
-- 
2.30.0.365.g02bc693789-goog

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to