[oe-commits] [openembedded-core] 03/34: quilt: run ptest as normal user

git at git.openembedded.org git at git.openembedded.org
Sat Mar 26 22:50:13 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit f7d52d12f943b9e1f79b32758308607036d6a760
Author: Dengke Du <dengke.du at windriver.com>
AuthorDate: Fri Mar 25 04:28:54 2016 -0400

    quilt: run ptest as normal user
    
    When the user is root, run quilt ptest, the faildiff.test failed.
    Because in the faildiff.test, we drop the read permission of the
    file test.txt, we can't "quilt refresh" as normal user, so we got
    the following:
    	>~ .*diff:test\.txt: Permission denied
    	> Diff failed on file 'test.txt', aborting
    But when the user is root, we can access the file, so we got the
    following:
    	> Nothing in patch patchs/test.diff
    So the faildiff.test was failed. We should create a normal user
    to run the ptest in the run-ptest scripts to slove the problem.
    
    Signed-off-by: Dengke Du <dengke.du at windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/recipes-devtools/quilt/quilt.inc                    | 4 +++-
 meta/recipes-devtools/quilt/quilt/run-ptest              | 5 ++++-
 meta/recipes-devtools/quilt/quilt/{run-ptest => test.sh} | 4 ----
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/meta/recipes-devtools/quilt/quilt.inc b/meta/recipes-devtools/quilt/quilt.inc
index 837b36b..4e393c4 100644
--- a/meta/recipes-devtools/quilt/quilt.inc
+++ b/meta/recipes-devtools/quilt/quilt.inc
@@ -8,6 +8,7 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/quilt/quilt-${PV}.tar.gz \
         file://install.patch \
         file://run-ptest \
         file://Makefile \
+	file://test.sh \
 "
 
 SRC_URI[md5sum] = "fc0310db5868a0873d602d4332a76d43"
@@ -50,8 +51,9 @@ do_install_ptest() {
 	tar -cf - bin/ --exclude \*.in | ( cd ${D}${PTEST_PATH} && tar -xf - )
 	tar -cf - compat/ --exclude \*.in | ( cd ${D}${PTEST_PATH} && tar -xf - )
 	tar -cf - quilt/ --exclude \*.in | ( cd ${D}${PTEST_PATH} && tar -xf - )
-	tar -cf - test/ --exclude mail.test --exclude delete.test | ( cd ${D}${PTEST_PATH} && tar -xf - )
+	tar -cf - test/ --exclude mail.test --exclude delete.test | ( cd ${D}${PTEST_PATH} && tar -xf - && chmod 777 test)
 	cp ${WORKDIR}/Makefile ${D}${PTEST_PATH}
+	cp ${WORKDIR}/test.sh ${D}${PTEST_PATH}
 }
 
 RDEPENDS_${PN}-ptest = "make file sed gawk diffutils findutils ed perl \
diff --git a/meta/recipes-devtools/quilt/quilt/run-ptest b/meta/recipes-devtools/quilt/quilt/run-ptest
index 958a9df..4b808ae 100755
--- a/meta/recipes-devtools/quilt/quilt/run-ptest
+++ b/meta/recipes-devtools/quilt/quilt/run-ptest
@@ -1,5 +1,8 @@
 #!/bin/sh
 
+THIS_SH=/bin/sh
 ln -sf /bin/ed /usr/bin/ed
-for i in `ls test/*.test |awk -F. '{print $1}' |awk -F/ '{print $2}'`; do make check-$i; if [ $? -eq 0 ]; then echo PASS: $i.test; else echo FAIL: $i.test; fi; done
+/usr/sbin/adduser --disabled-password quilttest
+su -c "${THIS_SH} ./test.sh" quilttest
+/usr/sbin/deluser quilttest
 rm -f /usr/bin/ed
diff --git a/meta/recipes-devtools/quilt/quilt/run-ptest b/meta/recipes-devtools/quilt/quilt/test.sh
similarity index 74%
copy from meta/recipes-devtools/quilt/quilt/run-ptest
copy to meta/recipes-devtools/quilt/quilt/test.sh
index 958a9df..6563e4a 100755
--- a/meta/recipes-devtools/quilt/quilt/run-ptest
+++ b/meta/recipes-devtools/quilt/quilt/test.sh
@@ -1,5 +1 @@
-#!/bin/sh
-
-ln -sf /bin/ed /usr/bin/ed
 for i in `ls test/*.test |awk -F. '{print $1}' |awk -F/ '{print $2}'`; do make check-$i; if [ $? -eq 0 ]; then echo PASS: $i.test; else echo FAIL: $i.test; fi; done
-rm -f /usr/bin/ed

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list