[8/9] busybox: ship a symlink farm for ptest

Message ID b8925da9b9a6588e3281b2d31b15dbd9e5eb5f9d.1542939066.git.Qi.Chen@windriver.com
State New
Headers show
Series
  • Untitled series #16605
Related show

Commit Message

ChenQi Nov. 23, 2018, 2:16 a.m.
From: Ross Burton <ross.burton@intel.com>


Ship a symlink farm for busybox, which correctly considers SUID
split. This ensures that all utilities used in busybox's test cases
will first use that ones that are provided by busybox.

Modify run-ptest to prepend the directory to PATH, and also change
variable name from current_dir to current_path, as the former is
a little misleading. `readlink -f $0' gets a path to the current
script instead of the current directory.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>

---
 meta/recipes-core/busybox/busybox.inc     | 14 ++++++++++++++
 meta/recipes-core/busybox/files/run-ptest |  5 +++--
 2 files changed, 17 insertions(+), 2 deletions(-)

-- 
1.9.1

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index b45d2b6..68ba8c6 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -352,6 +352,20 @@  do_install_ptest () {
 	cp -r ${B}/testsuite ${D}${PTEST_PATH}/
 	cp ${B}/.config      ${D}${PTEST_PATH}/
 	ln -s /bin/busybox   ${D}${PTEST_PATH}/busybox
+
+	mkdir ${D}${PTEST_PATH}/bin
+	if [ "${BUSYBOX_SPLIT_SUID}" = "1" ]; then
+		while read link; do
+			ln -s ${base_bindir}/busybox.suid ${D}${PTEST_PATH}/bin/$(basename $link)
+		done <${D}${sysconfdir}/busybox.links.suid
+		while read link; do
+			ln -s ${base_bindir}/busybox.nosuid ${D}${PTEST_PATH}/bin/$(basename $link)
+		done <${D}${sysconfdir}/busybox.links.nosuid
+	else
+		while read link; do
+			ln -s ${base_bindir}/busybox ${D}${PTEST_PATH}/bin/$(basename $link)
+		done <${D}${sysconfdir}/busybox.links
+	fi
 }
 
 inherit update-alternatives
diff --git a/meta/recipes-core/busybox/files/run-ptest b/meta/recipes-core/busybox/files/run-ptest
index 8b99bed..b19e5b5 100644
--- a/meta/recipes-core/busybox/files/run-ptest
+++ b/meta/recipes-core/busybox/files/run-ptest
@@ -1,7 +1,8 @@ 
 #!/bin/sh
 
-current_dir=$(readlink -f $0)
-export bindir=$(dirname $current_dir)
+current_path=$(readlink -f $0)
+export bindir=$(dirname $current_path)
+export PATH=$bindir/bin:$PATH
 export SKIP_KNOWN_BUGS=1
 
 cd testsuite || exit 1