lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20770915-nolibc-run-user-v1-2-3caec61726dc@weissschuh.net>
Date:   Wed, 15 Sep 2077 02:13:53 +0200
From:   Thomas Weißschuh <linux@...ssschuh.net>
To:     Willy Tarreau <w@....eu>, Shuah Khan <shuah@...nel.org>
Cc:     linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
        Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH 2/2] selftests/nolibc: run-tests.sh: enable testing via
 qemu-user

qemu-user is faster than a full system test.

Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
---
 tools/testing/selftests/nolibc/run-tests.sh | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/selftests/nolibc/run-tests.sh
index 3a1eaccfbd8d..c0a5a7cea9fa 100755
--- a/tools/testing/selftests/nolibc/run-tests.sh
+++ b/tools/testing/selftests/nolibc/run-tests.sh
@@ -14,9 +14,10 @@ cache_dir="${XDG_CACHE_HOME:-"$HOME"/.cache}"
 download_location="${cache_dir}/crosstools/"
 build_location="$(realpath "${cache_dir}"/nolibc-tests/)"
 perform_download=0
+test_mode=system
 archs="i386 x86_64 arm64 arm mips32le mips32be ppc ppc64 ppc64le riscv s390 loongarch"
 
-TEMP=$(getopt -o 'j:d:c:b:a:ph' -n "$0" -- "$@")
+TEMP=$(getopt -o 'j:d:c:b:a:m:ph' -n "$0" -- "$@")
 
 eval set -- "$TEMP"
 unset TEMP
@@ -38,6 +39,7 @@ Options:
  -c [VERSION]   Version of toolchains to use (default: ${crosstool_version})
  -a [ARCH]      Host architecture of toolchains to use (default: ${hostarch})
  -b [DIR]       Build location (default: ${build_location})
+ -m [MODE]      Test mode user/system (default: ${test_mode})
 EOF
 }
 
@@ -61,6 +63,9 @@ while true; do
 		'-b')
 			build_location="$(realpath "$2")"
 			shift 2; continue ;;
+		'-m')
+			test_mode="$2"
+			shift 2; continue ;;
 		'-h')
 			print_usage
 			exit 0
@@ -133,11 +138,22 @@ test_arch() {
 	MAKE=(make -j"${nproc}" XARCH="${arch}" CROSS_COMPILE="${cross_compile}" O="${build_dir}")
 
 	mkdir -p "$build_dir"
-	if [ ! -f "${build_dir}/.config" ]; then
+	if [ "$test_mode" = "system" ] && [ ! -f "${build_dir}/.config" ]; then
 		swallow_output "${MAKE[@]}" defconfig
 	fi
+	case "$test_mode" in
+		'system')
+			test_target=run
+			;;
+		'user')
+			test_target=run-user
+			;;
+		*)
+			echo "Unknown mode $test_mode"
+			exit 1
+	esac
 	printf '%-15s' "$arch:"
-	swallow_output "${MAKE[@]}" run V=1
+	swallow_output "${MAKE[@]}" "$test_target" V=1
 	cp run.out run.out."${arch}"
 	"${MAKE[@]}" report | grep passed
 }

-- 
2.42.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ