aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-15 17:17:32 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-15 17:17:32 -0500
commit09dee2a608a4a7d42f021f83084ade7de2415d7e (patch)
tree5e5cce54d2f20763e03eaeb07aaac1bffd968f9d
parentd25b6af91ec600faaff3a7e863f19d3e16593e52 (diff)
parent22f6592b23ef8a0c09283bcb13087340721e1154 (diff)
Merge tag 'linux-kselftest-4.10-rc1-update' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kselftest updates from Shuah Khan: "This update consists of: - new tests to exercise the Sync Kernel Infrastructure. These tests are part of a battery of Android libsync tests and are re-written to test the new sync user-space interfaces from Emilio López, and Gustavo Padovan. - test to run hw-independent mock tests for i915.ko from Chris Wilson - a new gpio test case from Bamvor Jian Zhang - missing gitignore additions" * tag 'linux-kselftest-4.10-rc1-update' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftest/gpio: add gpio test case selftest: sync: improve assert() failure message kselftests: Exercise hw-independent mock tests for i915.ko selftests: add missing gitignore files/dirs selftests: add missing set-tz to timers .gitignore selftest: sync: stress test for merges selftest: sync: stress consumer/producer test selftest: sync: stress test for parallelism selftest: sync: wait tests for sw_sync framework selftest: sync: merge tests for sw_sync framework selftest: sync: fence tests for sw_sync framework selftest: sync: basic tests for sw_sync framework
-rw-r--r--tools/testing/selftests/.gitignore1
-rw-r--r--tools/testing/selftests/Makefile2
-rwxr-xr-xtools/testing/selftests/drivers/gpu/i915.sh14
-rw-r--r--tools/testing/selftests/gpio/Makefile23
-rw-r--r--tools/testing/selftests/gpio/gpio-mockup-chardev.c324
-rwxr-xr-xtools/testing/selftests/gpio/gpio-mockup-sysfs.sh134
-rwxr-xr-xtools/testing/selftests/gpio/gpio-mockup.sh201
-rw-r--r--tools/testing/selftests/nsfs/.gitignore2
-rw-r--r--tools/testing/selftests/sigaltstack/.gitignore1
-rw-r--r--tools/testing/selftests/sync/.gitignore1
-rw-r--r--tools/testing/selftests/sync/Makefile24
-rw-r--r--tools/testing/selftests/sync/sw_sync.h46
-rw-r--r--tools/testing/selftests/sync/sync.c221
-rw-r--r--tools/testing/selftests/sync/sync.h40
-rw-r--r--tools/testing/selftests/sync/sync_alloc.c74
-rw-r--r--tools/testing/selftests/sync/sync_fence.c132
-rw-r--r--tools/testing/selftests/sync/sync_merge.c60
-rw-r--r--tools/testing/selftests/sync/sync_stress_consumer.c185
-rw-r--r--tools/testing/selftests/sync/sync_stress_merge.c115
-rw-r--r--tools/testing/selftests/sync/sync_stress_parallelism.c111
-rw-r--r--tools/testing/selftests/sync/sync_test.c79
-rw-r--r--tools/testing/selftests/sync/sync_wait.c91
-rw-r--r--tools/testing/selftests/sync/synctest.h66
-rw-r--r--tools/testing/selftests/timers/.gitignore1
24 files changed, 1948 insertions, 0 deletions
diff --git a/tools/testing/selftests/.gitignore b/tools/testing/selftests/.gitignore
new file mode 100644
index 000000000000..f0600d20ce7d
--- /dev/null
+++ b/tools/testing/selftests/.gitignore
@@ -0,0 +1 @@
kselftest
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index a3144a3de3a8..71b05891a6a1 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -7,6 +7,7 @@ TARGETS += exec
7TARGETS += firmware 7TARGETS += firmware
8TARGETS += ftrace 8TARGETS += ftrace
9TARGETS += futex 9TARGETS += futex
10TARGETS += gpio
10TARGETS += ipc 11TARGETS += ipc
11TARGETS += kcmp 12TARGETS += kcmp
12TARGETS += lib 13TARGETS += lib
@@ -24,6 +25,7 @@ TARGETS += seccomp
24TARGETS += sigaltstack 25TARGETS += sigaltstack
25TARGETS += size 26TARGETS += size
26TARGETS += static_keys 27TARGETS += static_keys
28TARGETS += sync
27TARGETS += sysctl 29TARGETS += sysctl
28ifneq (1, $(quicktest)) 30ifneq (1, $(quicktest))
29TARGETS += timers 31TARGETS += timers
diff --git a/tools/testing/selftests/drivers/gpu/i915.sh b/tools/testing/selftests/drivers/gpu/i915.sh
new file mode 100755
index 000000000000..d407f0fa1e3a
--- /dev/null
+++ b/tools/testing/selftests/drivers/gpu/i915.sh
@@ -0,0 +1,14 @@
1#!/bin/sh
2# Runs hardware independent tests for i915 (drivers/gpu/drm/i915)
3
4if ! /sbin/modprobe -q -r i915; then
5 echo "drivers/gpu/i915: [SKIP]"
6 exit 77
7fi
8
9if /sbin/modprobe -q i915 mock_selftests=-1; then
10 echo "drivers/gpu/i915: ok"
11else
12 echo "drivers/gpu/i915: [FAIL]"
13 exit 1
14fi
diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
new file mode 100644
index 000000000000..205e4d10e085
--- /dev/null
+++ b/tools/testing/selftests/gpio/Makefile
@@ -0,0 +1,23 @@
1
2TEST_PROGS := gpio-mockup.sh
3TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES)
4BINARIES := gpio-mockup-chardev
5
6include ../lib.mk
7
8all: $(BINARIES)
9
10clean:
11 $(RM) $(BINARIES)
12
13CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
14LDLIBS += -lmount -I/usr/include/libmount
15
16$(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
17
18../../../gpio/gpio-utils.o:
19 make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
20
21../../../../usr/include/linux/gpio.h:
22 make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell pwd)/../../../../usr/
23
diff --git a/tools/testing/selftests/gpio/gpio-mockup-chardev.c b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
new file mode 100644
index 000000000000..667e916fa7cc
--- /dev/null
+++ b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
@@ -0,0 +1,324 @@
1/*
2 * GPIO chardev test helper
3 *
4 * Copyright (C) 2016 Bamvor Jian Zhang
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10
11#define _GNU_SOURCE
12#include <unistd.h>
13#include <stdio.h>
14#include <stdlib.h>
15#include <stdio.h>
16#include <errno.h>
17#include <string.h>
18#include <fcntl.h>
19#include <getopt.h>
20#include <sys/ioctl.h>
21#include <libmount.h>
22#include <err.h>
23#include <dirent.h>
24#include <linux/gpio.h>
25#include "../../../gpio/gpio-utils.h"
26
27#define CONSUMER "gpio-selftest"
28#define GC_NUM 10
29enum direction {
30 OUT,
31 IN
32};
33
34static int get_debugfs(char **path)
35{
36 struct libmnt_context *cxt;
37 struct libmnt_table *tb;
38 struct libmnt_iter *itr = NULL;
39 struct libmnt_fs *fs;
40 int found = 0;
41
42 cxt = mnt_new_context();
43 if (!cxt)
44 err(EXIT_FAILURE, "libmount context allocation failed");
45
46 itr = mnt_new_iter(MNT_ITER_FORWARD);
47 if (!itr)
48 err(EXIT_FAILURE, "failed to initialize libmount iterator");
49
50 if (mnt_context_get_mtab(cxt, &tb))
51 err(EXIT_FAILURE, "failed to read mtab");
52
53 while (mnt_table_next_fs(tb, itr, &fs) == 0) {
54 const char *type = mnt_fs_get_fstype(fs);
55
56 if (!strcmp(type, "debugfs")) {
57 found = 1;
58 break;
59 }
60 }
61 if (found)
62 asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
63
64 mnt_free_iter(itr);
65 mnt_free_context(cxt);
66
67 if (!found)
68 return -1;
69
70 return 0;
71}
72
73static int gpio_debugfs_get(const char *consumer, int *dir, int *value)
74{
75 char *debugfs;
76 FILE *f;
77 char *line = NULL;
78 size_t len = 0;
79 char *cur;
80 int found = 0;
81
82 if (get_debugfs(&debugfs) != 0)
83 err(EXIT_FAILURE, "debugfs is not mounted");
84
85 f = fopen(debugfs, "r");
86 if (!f)
87 err(EXIT_FAILURE, "read from gpio debugfs failed");
88
89 /*
90 * gpio-2 ( |gpio-selftest ) in lo
91 */
92 while (getline(&line, &len, f) != -1) {
93 cur = strstr(line, consumer);
94 if (cur == NULL)
95 continue;