busybox: add do_check.

This commit is contained in:
maxice8 2017-11-18 04:45:27 -02:00 committed by Enno Boland
parent 41f8b27777
commit feecf69202
4 changed files with 136 additions and 0 deletions

View file

@ -0,0 +1,79 @@
From 9a522cf388e321b47f9462bbbd7726323095f8db Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 6 Jul 2017 13:41:32 +0200
Subject: [PATCH 11/11] testsuite: fix cpio tests
The cpio tests don't search for the right output line correctly,
using a hardcoded tail offset. Instead, grep for the file entry
just added.
The reverse-hunk patch tests seem to get the output order wrong,
and the tests pass when this is corrected.
---
testsuite/cpio.tests | 6 +++---
testsuite/patch.tests | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
--- testsuite/cpio.tests
+++ testsuite/cpio.tests
@@ -129,7 +129,7 @@ SKIP=
optional FEATURE_CPIO_O
testing "cpio uses by default uid/gid" \
-"echo $0 | cpio -o -H newc | cpio -tv 2>&1 | tail -n +2 | awk ' { print \$2 } '; echo \$?" \
+"echo $0 | cpio -o -H newc | cpio -tv 2>&1 | grep -F $(basename $0) | awk ' { print \$2 } '; echo \$?" \
"\
$user/$group
0
@@ -138,7 +138,7 @@ SKIP=
optional FEATURE_CPIO_O
testing "cpio -R with create" \
-"echo $0 | cpio -o -H newc -R 1234:5678 | cpio -tv 2>&1 | tail -n +2 | awk ' { print \$2 } '; echo \$?" \
+"echo $0 | cpio -o -H newc -R 1234:5678 | cpio -tv 2>&1 | grep -F $(basename $0) | awk ' { print \$2 } '; echo \$?" \
"\
1234/5678
0
@@ -147,7 +147,7 @@ SKIP=
optional FEATURE_CPIO_O
testing "cpio -R with extract" \
-"echo $0 | cpio -o -H newc | cpio -tv -R 8765:4321 2>&1 | tail -n +2 | awk ' { print \$2 } '; echo \$?" \
+"echo $0 | cpio -o -H newc | cpio -tv -R 8765:4321 2>&1 | grep -F $(basename $0) | awk ' { print \$2 } '; echo \$?" \
"\
8765/4321
0
--- testsuite/patch.tests
+++ testsuite/patch.tests
@@ -75,12 +75,12 @@ zxc
testing "patch detects already applied hunk" \
'patch 2>&1; echo $?; cat input' \
"\
+patching file input
Possibly reversed hunk 1 at 4
Hunk 1 FAILED 1/1.
abc
+def
123
-patching file input
1
abc
def
@@ -103,12 +103,12 @@ def
testing "patch detects already applied hunk at the EOF" \
'patch 2>&1; echo $?; cat input' \
"\
+patching file input
Possibly reversed hunk 1 at 4
Hunk 1 FAILED 1/1.
abc
123
+456
-patching file input
1
abc
123
--
2.13.2

View file

@ -0,0 +1,12 @@
The format for the `date` command has changed and this test wasn't updated with it.
--- testsuite/date/date-works
+++ testsuite/date/date-works
@@ -1,6 +1,6 @@
dt=`busybox date`
# Expected format: Fri Apr 25 03:47:55 CEST 2008
-dt=`echo "$dt" | sed 's/^[^ ][^ ][^ ] [^ ][^ ][^ ] [ 0123][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9] [A-Z][A-Z]* [012][0-9][0-9][0-9]$/OK/'`
+dt=`echo "$dt" | sed 's/^[^ ][^ ][^ ] [^ ][^ ][^ ] [ 0123][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9] -[0-9][0-9]* [012][0-9][0-9][0-9]$/OK/'`
test x"$dt" = x"OK"
dt=`busybox date -d 1:2`

View file

@ -0,0 +1,24 @@
The test assumes the system runs a binary called init as pid1 but Void Linux runs runit
which does not call itself init, so we adjust this test.
--- testsuite/pidof.tests
+++ testsuite/pidof.tests
@@ -19,15 +19,15 @@ testing "pidof (exit with success)" "pidof pidof > /dev/null; echo \$?" \
testing "pidof this" "pidof pidof.tests | grep -o -w $$" "$$\n" "" ""
optional FEATURE_PIDOF_SINGLE
-testing "pidof -s" "pidof -s init" "1\n" "" ""
+testing "pidof -s" "pidof -s runit" "1\n" "" ""
SKIP=
optional FEATURE_PIDOF_OMIT FEATURE_PIDOF_SINGLE
# This test fails now because process name matching logic has changed,
# but new logic is not "wrong" either... see find_pid_by_name.c comments
#testing "pidof -o %PPID" "pidof -o %PPID pidof.tests | grep -o -w $$" "" "" ""
-testing "pidof -o %PPID NOP" "pidof -o %PPID -s init" "1\n" "" ""
-testing "pidof -o init" "pidof -o 1 init | grep -o -w 1" "" "" ""
+testing "pidof -o %PPID NOP" "pidof -o %PPID -s runit" "1\n" "" ""
+testing "pidof -o runit" "pidof -o 1 runit | grep -o -w 1" "" "" ""
SKIP=
exit $FAILCOUNT

View file

@ -3,6 +3,7 @@ pkgname=busybox
version=1.27.2
revision=1
hostmakedepends="perl"
checkdepends="zip"
short_desc="The Swiss Army Knife of Embedded Linux"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-2"
@ -64,6 +65,26 @@ do_build() {
make -C $t SKIP_STRIP=y CFLAGS="$(_cflags $t)" ${makejobs}
done
}
do_check() {
# Copy the testsuite into the busybox and it's static counterpart
# directory
cp -r src/testsuite busybox
cp -r src/testsuite busybox-static
# This is required by the testsuite
cp src/scripts/echo.c busybox/scripts
cp src/scripts/echo.c busybox-static/scripts
# Run testsuite for busybox
cd busybox/testsuite
SKIP_KNOWN_BUGS=yes ./runtest -v
cd ../../
# run testsuite for busybox-static
cd busybox-static/testsuite
SKIP_KNOWN_BUGS=yes ./runtest -v
}
do_install() {
vbin busybox/busybox_unstripped busybox
vman busybox/docs/busybox.1