* [PATCH 0/1] pTest-quilt: pTest-quilt failed fixed
@ 2016-03-23 11:14 Dengke Du
2016-03-23 11:14 ` [PATCH 1/1] " Dengke Du
0 siblings, 1 reply; 3+ messages in thread
From: Dengke Du @ 2016-03-23 11:14 UTC (permalink / raw)
Cc: openembedded-core
The following changes since commit 8037ba4d86a65ee296cfdcee736dfd614c568818:
bitbake: bb/tests/fetch: Update cups url (2016-03-21 12:43:12 +0000)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib dengke/pTest-quilt-fail-fixed
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=ptest-quilt
Dengke Du (1):
pTest-quilt: fixed the quilt ptest fail
meta/recipes-devtools/quilt/quilt.inc | 9 +++++++--
meta/recipes-devtools/quilt/quilt/run-ptest | 3 ++-
meta/recipes-devtools/quilt/quilt/test.sh | 1 +
3 files changed, 10 insertions(+), 3 deletions(-)
create mode 100755 meta/recipes-devtools/quilt/quilt/test.sh
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] pTest-quilt: pTest-quilt failed fixed
2016-03-23 11:14 [PATCH 0/1] pTest-quilt: pTest-quilt failed fixed Dengke Du
@ 2016-03-23 11:14 ` Dengke Du
2016-03-24 9:23 ` Tudor Florea
0 siblings, 1 reply; 3+ messages in thread
From: Dengke Du @ 2016-03-23 11:14 UTC (permalink / raw)
Cc: openembedded-core
When run the pTest-quilt, the faildiff.test failed, because the user
is root. The faildiff.test had the following:
$ chmod -r test.txt
$ quilt refresh
Then 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 get the
following:
> Nothing in patch patchs/test.dfff
So I add a user who named "test" to run the pTest, when we run the
run-ptest script. In this way, we should add the user at the begining.
Add the useradd inherit to the meta/recipes-devtools/quilt/quilt.inc
and set the USERADD_PACKAGES and USERADD_PARAM_${PN}-ptest variable
respectively.
In the end, change the authority of the directory of test which collect
all the test case under the directory /usr/lib/quilt/ptest/ on the
target to 777. Because the test case would write this directory, if
the user is test user, it can't write this directory.
Signed-off-by: Dengke Du <dengke.du@windriver.com>
---
meta/recipes-devtools/quilt/quilt.inc | 9 +++++++--
meta/recipes-devtools/quilt/quilt/run-ptest | 3 ++-
meta/recipes-devtools/quilt/quilt/test.sh | 1 +
3 files changed, 10 insertions(+), 3 deletions(-)
create mode 100755 meta/recipes-devtools/quilt/quilt/test.sh
diff --git a/meta/recipes-devtools/quilt/quilt.inc b/meta/recipes-devtools/quilt/quilt.inc
index 837b36b..65d40cc 100644
--- a/meta/recipes-devtools/quilt/quilt.inc
+++ b/meta/recipes-devtools/quilt/quilt.inc
@@ -8,12 +8,13 @@ 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"
SRC_URI[sha256sum] = "c4bfd3282214a288e8d3e921ae4d52e73e24c4fead72b5446752adee99a7affd"
-inherit autotools-brokensep ptest
+inherit autotools-brokensep ptest useradd
EXTRA_OECONF_darwin += "--without-date \
--without-getopt \
@@ -35,6 +36,9 @@ EXTRA_OE_MAKE_ARGS ?= "BUILD_ROOT=${D}"
CACHED_CONFIGUREVARS += "ac_cv_path_BASH=/bin/bash"
+USERADD_PACKAGES = "${PN}-ptest"
+USERADD_PARAM_${PN}-ptest = "--create-home --user-group test"
+
# quilt ignores DESTDIR
do_install () {
oe_runmake ${EXTRA_OE_MAKE_ARGS} install
@@ -50,8 +54,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..14430a2 100755
--- a/meta/recipes-devtools/quilt/quilt/run-ptest
+++ b/meta/recipes-devtools/quilt/quilt/run-ptest
@@ -1,5 +1,6 @@
#!/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
+su -c "${THIS_SH} ./test.sh" test
rm -f /usr/bin/ed
diff --git a/meta/recipes-devtools/quilt/quilt/test.sh b/meta/recipes-devtools/quilt/quilt/test.sh
new file mode 100755
index 0000000..6563e4a
--- /dev/null
+++ b/meta/recipes-devtools/quilt/quilt/test.sh
@@ -0,0 +1 @@
+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
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] pTest-quilt: pTest-quilt failed fixed
2016-03-23 11:14 ` [PATCH 1/1] " Dengke Du
@ 2016-03-24 9:23 ` Tudor Florea
0 siblings, 0 replies; 3+ messages in thread
From: Tudor Florea @ 2016-03-24 9:23 UTC (permalink / raw)
To: Dengke Du; +Cc: openembedded-core
A few comments:
1. (Editorial) Please use the appropriate package name and description
of the fix in the commit message:
e.g.: "quilt: run ptest as normal user" or similar
2. I would avoid using the user "test" in this context. "test" user
might be a legitimate one in some actual deployment and could interfere
this this one.
3. I'd avoid having the user persistent on rootfs (created on
post-install script) Instead I would create a regular user at the
beginning of test and removing it at the end. You may take a look on
libpam recipe tests.
Regards,
Tudor.
On 23/03/2016 13:14, Dengke Du wrote:
> When run the pTest-quilt, the faildiff.test failed, because the user
> is root. The faildiff.test had the following:
> $ chmod -r test.txt
> $ quilt refresh
> Then 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 get the
> following:
> > Nothing in patch patchs/test.dfff
> So I add a user who named "test" to run the pTest, when we run the
> run-ptest script. In this way, we should add the user at the begining.
> Add the useradd inherit to the meta/recipes-devtools/quilt/quilt.inc
> and set the USERADD_PACKAGES and USERADD_PARAM_${PN}-ptest variable
> respectively.
> In the end, change the authority of the directory of test which collect
> all the test case under the directory /usr/lib/quilt/ptest/ on the
> target to 777. Because the test case would write this directory, if
> the user is test user, it can't write this directory.
>
> Signed-off-by: Dengke Du <dengke.du@windriver.com>
> ---
> meta/recipes-devtools/quilt/quilt.inc | 9 +++++++--
> meta/recipes-devtools/quilt/quilt/run-ptest | 3 ++-
> meta/recipes-devtools/quilt/quilt/test.sh | 1 +
> 3 files changed, 10 insertions(+), 3 deletions(-)
> create mode 100755 meta/recipes-devtools/quilt/quilt/test.sh
>
> diff --git a/meta/recipes-devtools/quilt/quilt.inc b/meta/recipes-devtools/quilt/quilt.inc
> index 837b36b..65d40cc 100644
> --- a/meta/recipes-devtools/quilt/quilt.inc
> +++ b/meta/recipes-devtools/quilt/quilt.inc
> @@ -8,12 +8,13 @@ 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"
> SRC_URI[sha256sum] = "c4bfd3282214a288e8d3e921ae4d52e73e24c4fead72b5446752adee99a7affd"
>
> -inherit autotools-brokensep ptest
> +inherit autotools-brokensep ptest useradd
>
> EXTRA_OECONF_darwin += "--without-date \
> --without-getopt \
> @@ -35,6 +36,9 @@ EXTRA_OE_MAKE_ARGS ?= "BUILD_ROOT=${D}"
>
> CACHED_CONFIGUREVARS += "ac_cv_path_BASH=/bin/bash"
>
> +USERADD_PACKAGES = "${PN}-ptest"
> +USERADD_PARAM_${PN}-ptest = "--create-home --user-group test"
> +
> # quilt ignores DESTDIR
> do_install () {
> oe_runmake ${EXTRA_OE_MAKE_ARGS} install
> @@ -50,8 +54,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..14430a2 100755
> --- a/meta/recipes-devtools/quilt/quilt/run-ptest
> +++ b/meta/recipes-devtools/quilt/quilt/run-ptest
> @@ -1,5 +1,6 @@
> #!/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
> +su -c "${THIS_SH} ./test.sh" test
> rm -f /usr/bin/ed
> diff --git a/meta/recipes-devtools/quilt/quilt/test.sh b/meta/recipes-devtools/quilt/quilt/test.sh
> new file mode 100755
> index 0000000..6563e4a
> --- /dev/null
> +++ b/meta/recipes-devtools/quilt/quilt/test.sh
> @@ -0,0 +1 @@
> +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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-24 9:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-23 11:14 [PATCH 0/1] pTest-quilt: pTest-quilt failed fixed Dengke Du
2016-03-23 11:14 ` [PATCH 1/1] " Dengke Du
2016-03-24 9:23 ` Tudor Florea
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox