Commit a448c643 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'linux-kselftest-5.1-rc1' of...

Merge tag 'linux-kselftest-5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull kselftest update fromShuah Khan:

 - ir test compile warnings fixes

 - seccomp test fixes and improvements from Tycho Andersen and Kees Cook

 - ftrace fixes to non-POSIX-compliant constructs in colored output code
   and handling absence of tput from Juerg Haefliger

* tag 'linux-kselftest-5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests/ftrace: Handle the absence of tput
  selftests/ftrace: Replace \e with \033
  selftests/ftrace: Replace echo -e with printf
  selftests: ir: skip when non-root user runs the test
  selftests: ir: skip when lirc device doesn't exist.
  selftests: ir: fix warning: "%s" directive output may be truncated ’ directive output may be truncated
  selftests/seccomp: Actually sleep for 1/10th second
  selftests/harness: Update named initializer syntax
  selftests: unshare userns in seccomp pidns testcases
  selftests: set NO_NEW_PRIVS bit in seccomp user tests
  selftests: skip seccomp get_metadata test if not real root
  selftest: include stdio.h in kselftest.h
  selftests: fix typo in seccomp_bpf.c
  selftests: don't kill child immediately in get_metadata() test
parents 2bb99540 0e27ded1
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -154,17 +154,17 @@ fi

# Define text colors
# Check available colors on the terminal, if any
ncolors=`tput colors 2>/dev/null`
ncolors=`tput colors 2>/dev/null || echo 0`
color_reset=
color_red=
color_green=
color_blue=
# If stdout exists and number of colors is eight or more, use them
if [ -t 1 -a "$ncolors" -a "$ncolors" -ge 8 ]; then
  color_reset="\e[0m"
  color_red="\e[31m"
  color_green="\e[32m"
  color_blue="\e[34m"
if [ -t 1 -a "$ncolors" -ge 8 ]; then
  color_reset="\033[0m"
  color_red="\033[31m"
  color_green="\033[32m"
  color_blue="\033[34m"
fi

strip_esc() {
@@ -173,8 +173,13 @@ strip_esc() {
}

prlog() { # messages
  echo -e "$@"
  [ "$LOG_FILE" ] && echo -e "$@" | strip_esc >> $LOG_FILE
  newline="\n"
  if [ "$1" = "-n" ] ; then
    newline=
    shift
  fi
  printf "$*$newline"
  [ "$LOG_FILE" ] && printf "$*$newline" | strip_esc >> $LOG_FILE
}
catlog() { #file
  cat $1
+4 −2
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@

#define TEST_SCANCODES	10
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#define SYSFS_PATH_MAX 256
#define DNAME_PATH_MAX 256

static const struct {
	enum rc_proto proto;
@@ -56,7 +58,7 @@ static const struct {
int lirc_open(const char *rc)
{
	struct dirent *dent;
	char buf[100];
	char buf[SYSFS_PATH_MAX + DNAME_PATH_MAX];
	DIR *d;
	int fd;

@@ -74,7 +76,7 @@ int lirc_open(const char *rc)
	}

	if (!dent)
		ksft_exit_fail_msg("cannot find lirc device for %s\n", rc);
		ksft_exit_skip("cannot find lirc device for %s\n", rc);

	closedir(d);

+5 −0
Original line number Diff line number Diff line
@@ -4,6 +4,11 @@
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

if [ $UID != 0 ]; then
	echo "Please run ir_loopback test as root [SKIP]"
	exit $ksft_skip
fi

if ! /sbin/modprobe -q -n rc-loopback; then
        echo "ir_loopback: module rc-loopback is not found [SKIP]"
        exit $ksft_skip
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <stdio.h>

/* define kselftest exit codes */
#define KSFT_PASS  0
+5 −5
Original line number Diff line number Diff line
@@ -168,8 +168,8 @@
#define __TEST_IMPL(test_name, _signal) \
	static void test_name(struct __test_metadata *_metadata); \
	static struct __test_metadata _##test_name##_object = \
		{ name: "global." #test_name, \
		  fn: &test_name, termsig: _signal }; \
		{ .name = "global." #test_name, \
		  .fn = &test_name, .termsig = _signal }; \
	static void __attribute__((constructor)) _register_##test_name(void) \
	{ \
		__register_test(&_##test_name##_object); \
@@ -304,9 +304,9 @@
	} \
	static struct __test_metadata \
		      _##fixture_name##_##test_name##_object = { \
		name: #fixture_name "." #test_name, \
		fn: &wrapper_##fixture_name##_##test_name, \
		termsig: signal, \
		.name = #fixture_name "." #test_name, \
		.fn = &wrapper_##fixture_name##_##test_name, \
		.termsig = signal, \
	 }; \
	static void __attribute__((constructor)) \
			_register_##fixture_name##_##test_name(void) \
Loading