[Toybox] Fwd: [PATCH v1] Fix broken test due to directory symlink

enh enh at google.com
Tue Nov 8 13:52:34 PST 2022


sorry, didn't notice yesterday that this patch hadn't cc:ed the
mailing list... correcting that now...

(if you're wondering _why_ this is the way it is, it's because that
symlink lets us paper over the question of "which exact partition is
this on?", and that question is very important in Android-land because
different groups "own" different partitions, so where the symlink
points decides who owns the modules...)

---------- Forwarded message ---------
From: Kelvin Zhang <zhangkelvin at google.com>
Date: Mon, Nov 7, 2022 at 4:32 PM
Subject: [PATCH v1] Fix broken test due to directory symlink

/vendor/lib/modules is a symlink directory, when running
`find /vendor/lib/modules` , find just return the symlink itself. If we
add a trailing slash / (`find /vendor/lib/modules/`), find will actually
search into the symlinked directory.

Test: ./run-tests-on-android.sh modinfo
Bug: 258019034

Signed-off-by: Kelvin Zhang <zhangkelvin at google.com>
---
 tests/modinfo.test | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/modinfo.test b/tests/modinfo.test
index 261acfda..b860a3ea 100644
--- a/tests/modinfo.test
+++ b/tests/modinfo.test
@@ -17,9 +17,9 @@ fi
 testcmd "missing" "missing 2>&1" "modinfo: missing: not found\n" "" ""

 # Find some modules to work with.
-MODULE_PATH1=$(find $MODULE_ROOT/lib/modules -name *.ko | head -1 2>/dev/null)
+MODULE_PATH1=$(find $MODULE_ROOT/lib/modules/ -name *.ko | head -1 2>/dev/null)
 MODULE1=$(basename -s .ko $MODULE_PATH1)
-MODULE_PATH2=$(find $MODULE_ROOT/lib/modules -name *.ko | head -2 |
tail -1 2>/dev/null)
+MODULE_PATH2=$(find $MODULE_ROOT/lib/modules/ -name *.ko | head -2 |
tail -1 2>/dev/null)
 MODULE2=$(basename -s .ko $MODULE_PATH2)
 DASH_MODULE=$(basename -s .ko \
   $(find $MODULE_ROOT/lib/modules -name *-*.ko | tail -1 2>/dev/null))
--
2.38.1.431.g37b22c650d-goog


More information about the Toybox mailing list