From: Tudor Florea <tudor.florea@enea.com>
To: Dengke Du <dengke.du@windriver.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 1/1] pTest-quilt: pTest-quilt failed fixed
Date: Thu, 24 Mar 2016 11:23:29 +0200 [thread overview]
Message-ID: <56F3B211.7000904@enea.com> (raw)
In-Reply-To: <ecd80b5ad2eb73b3c5615d3b8985c30c7d088bd6.1458731173.git.dengke.du@windriver.com>
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
>
prev parent reply other threads:[~2016-03-24 9:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56F3B211.7000904@enea.com \
--to=tudor.florea@enea.com \
--cc=dengke.du@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox