Skip to contentSkip to conversation

procps: support ptest

PATCH In review [email protected] 2 participants 3 messages Jan 14 – Jan 16

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 procps: support ptest

From: Changqing Li <[email protected]>

support ptest for procps, procps's testsuite use DejaGnu test framework. The testsuite is expected to run during build time, this implementation create the same folder structure as the testsuite expected to make it can work well.

---
 .../distro/include/ptest-packagelists.inc     |  1 +
 meta/recipes-extended/procps/procps/run-ptest |  7 +++
 meta/recipes-extended/procps/procps_4.0.5.bb  | 50 ++++++++++++++++++-
 3 files changed, 56 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-extended/procps/procps/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index fff2947177..0a4ff49ee3 100644
@@ -57,6 +57,7 @@ PTESTS_FAST = "\
     nettle \
     opkg \
     popt \
+    procps \
     python3-atomicwrites \
     python3-attrs \
     python3-bcrypt \
meta/recipes-extended/procps/procps/run-ptest new file +7 -0
new file mode 100644
index 0000000000..c999876bd8
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+cd ./testsuite
+for tool in @DEJATOOL@;do
+    runtest -a --tool $tool --outdir ../log 
+done
+
meta/recipes-extended/procps/procps_4.0.5.bb +48 -2

73 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw

Hi,

Quoted 112 lines · Changqing Li via lists.openembedded.org

From: Changqing Li <[email protected]>

support ptest for procps, procps's testsuite use DejaGnu test framework. The testsuite is expected to run during build time, this implementation create the same folder structure as the testsuite expected to make it can work well.

---
 .../distro/include/ptest-packagelists.inc     |  1 +
 meta/recipes-extended/procps/procps/run-ptest |  7 +++
 meta/recipes-extended/procps/procps_4.0.5.bb  | 50 ++++++++++++++++++-
 3 files changed, 56 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-extended/procps/procps/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index fff2947177..0a4ff49ee3 100644
@@ -57,6 +57,7 @@ PTESTS_FAST = "\
     nettle \
     opkg \
     popt \
+    procps \
     python3-atomicwrites \
     python3-attrs \
     python3-bcrypt \
meta/recipes-extended/procps/procps/run-ptest new file +7 -0
new file mode 100644
index 0000000000..c999876bd8
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+cd ./testsuite
+for tool in @DEJATOOL@;do
+    runtest -a --tool $tool --outdir ../log 
+done
+
meta/recipes-extended/procps/procps_4.0.5.bb +46 -2
index 0e0e06f0d2..b4697f7ce3 100644
@@ -10,11 +10,12 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
 
 DEPENDS = "ncurses"
 
-inherit autotools gettext pkgconfig update-alternatives
+inherit autotools gettext pkgconfig update-alternatives ptest
 
 SRC_URI = "git://gitlab.com/procps-ng/procps.git;protocol=https;branch=master;tag=v${PV} \
            file://sysctl.conf \
            file://top_large_pid_fix.patch \
+           file://run-ptest \
            "
 SRCREV = "f46b2f7929cdfe2913ed0a7f585b09d6adbf994e"
 
@@ -47,8 +48,51 @@ do_install:append () {
         fi
 }
 
-CONFFILES:${PN} = "${sysconfdir}/sysctl.conf"
+do_compile_ptest() {
+    oe_runmake -C testsuite site.exp
+    oe_runmake src/tests/test_process src/tests/test_strutils  src/tests/test_fileutils src/tests/test_shm
+    DEJATOOL=$(make -C testsuite -s -f Makefile -f - <<'EOF'
+all:
+	$(info $(DEJATOOL))
+EOF
+)
+    echo $DEJATOOL > ${B}/testsuite/.dejatool
+}
 
+do_install_ptest() {
+     install -d ${D}${PTEST_PATH}/testsuite
+     install -d ${D}${PTEST_PATH}/src
+     install -d ${D}${PTEST_PATH}/log
+
+     cp -r ${S}/testsuite/* ${D}${PTEST_PATH}/testsuite/
+     cp -r ${B}/testsuite/* ${D}${PTEST_PATH}/testsuite/
+     cp -r ${B}/src/tests ${D}${PTEST_PATH}/src/
+
+     rm -rf ${D}${PTEST_PATH}/testsuite/Makefile*
+     rm -rf ${D}${PTEST_PATH}/testsuite/README
+     find ${D}${PTEST_PATH}/testsuite/ -type f -name "*.o" -exec rm -f {} +
+     find ${D}${PTEST_PATH}/src/ -type f -name "*.o" -exec rm -f {} +
+
+     sed -i -e "/set srcdir/c\set srcdir ${PTEST_PATH}/testsuite" \
+            -e "/set objdir/c\set objdir ${PTEST_PATH}/testsuite" ${D}${PTEST_PATH}/testsuite/site.exp
+
+     DEJATOOL=$(cat ${B}/testsuite/.dejatool)
+     sed -i -e "s#@DEJATOOL@#$DEJATOOL#g" ${D}${PTEST_PATH}/run-ptest
+     for p in $DEJATOOL; do
+        if [ "$p" = "ps" ]; then
+            install -d ${D}${PTEST_PATH}/src/ps
+            ln -sf ${base_bindir}/ps ${D}${PTEST_PATH}/src/ps/pscommand
+        elif [ "$p" = "sysctl" ]; then
+            ln -sf ${base_sbindir}/$p ${D}${PTEST_PATH}/src/$p
+        elif [ "$p" = "kill" ] || [ "$p" = "pidof" ] || [ "$p" = "watch" ]; then
+            ln -sf ${base_bindir}/$p ${D}${PTEST_PATH}/src/$p
+        else
+            ln -sf ${bindir}/$p ${D}${PTEST_PATH}/src/$p
+        fi
+     done
+}
+
+CONFFILES:${PN} = "${sysconfdir}/sysctl.conf"
 bindir_progs = "free pkill pmap pgrep pwdx skill snice top uptime w"
 base_bindir_progs += "kill pidof ps watch"
 base_sbindir_progs += "sysctl"

meta/recipes-extended/procps/procps_4.0.5.bb RDEPENDS:${PN} += "${PROCPS_PACKAGES}" · line 131

Quoted 8 lines
meta/recipes-extended/procps/procps_4.0.5.bb +2 -0
@@ -80,6 +124,8 @@ RDEPENDS:${PN} += "${PROCPS_PACKAGES}"
 RDEPENDS:${PN}-ps += "${PN}-lib"
 RDEPENDS:${PN}-sysctl += "${PN}-lib"
 
+RDEPENDS:${PN}-ptest += "dejagnu bash glibc-utils"
+
 FILES:${PN}-lib = "${libdir}"
 FILES:${PN}-ps = "${base_bindir}/ps.${BPN}"
 FILES:${PN}-sysctl = "${base_sbindir}/sysctl.${BPN} ${sysconfdir}/sysctl.conf ${sysconfdir}/sysctl.d"

I think this triggered the following error on our test infrastructure:

NOTE: Resolving any missing task queue dependencies
ERROR: Nothing RPROVIDES 'glibc-utils' (but /srv/pokybuild/yocto-worker/musl-qemux86/build/layers/openembedded-core/meta/recipes-extended/procps/procps_4.0.5.bb RDEPENDS on or otherwise requires it)

Can you have a look?

https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/4942697/raw_inline
https://autobuilder.yoctoproject.org/valkyrie/#/builders/6/builds/3047

Antonin

Signature · 3 lines
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw
Quoted 131 lines · Antonin Godard via lists.openembedded.org

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Hi,

Quoted 112 lines · Changqing Li via lists.openembedded.org

From: Changqing Li <[email protected]>

support ptest for procps, procps's testsuite use DejaGnu test framework. The testsuite is expected to run during build time, this implementation create the same folder structure as the testsuite expected to make it can work well.

---
  .../distro/include/ptest-packagelists.inc     |  1 +
  meta/recipes-extended/procps/procps/run-ptest |  7 +++
  meta/recipes-extended/procps/procps_4.0.5.bb  | 50 ++++++++++++++++++-
  3 files changed, 56 insertions(+), 2 deletions(-)

create mode 100644 meta/recipes-extended/procps/procps/run-ptest

meta/conf/distro/include/ptest-packagelists.inc +1 -0
index fff2947177..0a4ff49ee3 100644
@@ -57,6 +57,7 @@ PTESTS_FAST = "\
      nettle \
      opkg \
      popt \
+    procps \
      python3-atomicwrites \
      python3-attrs \
      python3-bcrypt \
meta/recipes-extended/procps/procps/run-ptest new file +7 -0
new file mode 100644
index 0000000000..c999876bd8
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+cd ./testsuite
+for tool in @DEJATOOL@;do
+    runtest -a --tool $tool --outdir ../log
+done
+
meta/recipes-extended/procps/procps_4.0.5.bb +46 -2
index 0e0e06f0d2..b4697f7ce3 100644
@@ -10,11 +10,12 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
 
  DEPENDS = "ncurses"
 
-inherit autotools gettext pkgconfig update-alternatives
+inherit autotools gettext pkgconfig update-alternatives ptest
 
  SRC_URI = "git://gitlab.com/procps-ng/procps.git;protocol=https;branch=master;tag=v${PV} \
             file://sysctl.conf \
             file://top_large_pid_fix.patch \
+           file://run-ptest \
             "
  SRCREV = "f46b2f7929cdfe2913ed0a7f585b09d6adbf994e"
 
@@ -47,8 +48,51 @@ do_install:append () {
          fi
  }
 
-CONFFILES:${PN} = "${sysconfdir}/sysctl.conf"
+do_compile_ptest() {
+    oe_runmake -C testsuite site.exp
+    oe_runmake src/tests/test_process src/tests/test_strutils  src/tests/test_fileutils src/tests/test_shm
+    DEJATOOL=$(make -C testsuite -s -f Makefile -f - <<'EOF'
+all:
+     $(info $(DEJATOOL))
+EOF
+)
+    echo $DEJATOOL > ${B}/testsuite/.dejatool
+}
 
+do_install_ptest() {
+     install -d ${D}${PTEST_PATH}/testsuite
+     install -d ${D}${PTEST_PATH}/src
+     install -d ${D}${PTEST_PATH}/log
+
+     cp -r ${S}/testsuite/* ${D}${PTEST_PATH}/testsuite/
+     cp -r ${B}/testsuite/* ${D}${PTEST_PATH}/testsuite/
+     cp -r ${B}/src/tests ${D}${PTEST_PATH}/src/
+
+     rm -rf ${D}${PTEST_PATH}/testsuite/Makefile*
+     rm -rf ${D}${PTEST_PATH}/testsuite/README
+     find ${D}${PTEST_PATH}/testsuite/ -type f -name "*.o" -exec rm -f {} +
+     find ${D}${PTEST_PATH}/src/ -type f -name "*.o" -exec rm -f {} +
+
+     sed -i -e "/set srcdir/c\set srcdir ${PTEST_PATH}/testsuite" \
+            -e "/set objdir/c\set objdir ${PTEST_PATH}/testsuite" ${D}${PTEST_PATH}/testsuite/site.exp
+
+     DEJATOOL=$(cat ${B}/testsuite/.dejatool)
+     sed -i -e "s#@DEJATOOL@#$DEJATOOL#g" ${D}${PTEST_PATH}/run-ptest
+     for p in $DEJATOOL; do
+        if [ "$p" = "ps" ]; then
+            install -d ${D}${PTEST_PATH}/src/ps
+            ln -sf ${base_bindir}/ps ${D}${PTEST_PATH}/src/ps/pscommand
+        elif [ "$p" = "sysctl" ]; then
+            ln -sf ${base_sbindir}/$p ${D}${PTEST_PATH}/src/$p
+        elif [ "$p" = "kill" ] || [ "$p" = "pidof" ] || [ "$p" = "watch" ]; then
+            ln -sf ${base_bindir}/$p ${D}${PTEST_PATH}/src/$p
+        else
+            ln -sf ${bindir}/$p ${D}${PTEST_PATH}/src/$p
+        fi
+     done
+}
+
+CONFFILES:${PN} = "${sysconfdir}/sysctl.conf"
  bindir_progs = "free pkill pmap pgrep pwdx skill snice top uptime w"
  base_bindir_progs += "kill pidof ps watch"
  base_sbindir_progs += "sysctl"

meta/recipes-extended/procps/procps_4.0.5.bb RDEPENDS:${PN} += "${PROCPS_PACKAGES}" · line 131

Quoted 8 lines
meta/recipes-extended/procps/procps_4.0.5.bb +2 -0
@@ -80,6 +124,8 @@ RDEPENDS:${PN} += "${PROCPS_PACKAGES}"
  RDEPENDS:${PN}-ps += "${PN}-lib"
  RDEPENDS:${PN}-sysctl += "${PN}-lib"
 
+RDEPENDS:${PN}-ptest += "dejagnu bash glibc-utils"
+
  FILES:${PN}-lib = "${libdir}"
  FILES:${PN}-ps = "${base_bindir}/ps.${BPN}"
  FILES:${PN}-sysctl = "${base_sbindir}/sysctl.${BPN} ${sysconfdir}/sysctl.conf ${sysconfdir}/sysctl.d"

I think this triggered the following error on our test infrastructure:

NOTE: Resolving any missing task queue dependencies
ERROR: Nothing RPROVIDES 'glibc-utils' (but /srv/pokybuild/yocto-worker/musl-qemux86/build/layers/openembedded-core/meta/recipes-extended/procps/procps_4.0.5.bb RDEPENDS on or otherwise requires it)

Quoted 6 lines

Can you have a look?

https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/4942697/raw_inline
https://autobuilder.yoctoproject.org/valkyrie/#/builders/6/builds/3047

Antonin

V2 patch is sent to fix this issue.

Regards

Changqing

Quoted 14 lines

--
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#229388): https://lists.openembedded.org/g/openembedded-core/message/229388
Mute This Topic: https://lists.openembedded.org/mt/117256827/3616873
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-