Hello open list:KERNEL SELFTEST FRAMEWORK,
We have not received a payment for this invoice yet. I am happy to answer any questions.
> http://edsqualityflooring.com/Question/
Kind Regards,
Shuah, please do
ln -s tools/testing/selftests test
It will save a lot of typing for everyone over the years.
Signed-off-by: Alexey Dobriyan <adobriyan(a)gmail.com>
---
test | 1 +
1 file changed, 1 insertion(+)
new file mode 120000
--- /dev/null
+++ b/test
@@ -0,0 +1 @@
+tools/testing/selftests
\ No newline at end of file
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
gcc warns about implicit declaration.
gcc -I../../../../usr/include/ msgque.c -o msgque
msgque.c: In function ‘restore_queue’:
msgque.c:52:7: warning: implicit declaration of function ‘msgget’
[-Wimplicit-function-declaration]
id = msgget(msgque->key, msgque->mode | IPC_CREAT | IPC_EXCL);
^~~~~~
msgque.c:66:7: warning: implicit declaration of function ‘msgsnd’
[-Wimplicit-function-declaration]
if (msgsnd(msgque->msq_id, &msgque->messages[i].mtype,
^~~~~~
msgque.c:76:6: warning: implicit declaration of function ‘msgctl’
[-Wimplicit-function-declaration]
if (msgctl(id, IPC_RMID, 0))
^~~~~~
msgque.c: In function ‘check_and_destroy_queue’:
msgque.c:87:9: warning: implicit declaration of function ‘msgrcv’
[-Wimplicit-function-declaration]
ret = msgrcv(msgque->msq_id, &message.mtype, MAX_MSG_SIZE,
^~~~~~
msgque.c: In function ‘main’:
msgque.c:204:15: warning: implicit declaration of function ‘ftok’
[-Wimplicit-function-declaration]
msgque.key = ftok(argv[0], 822155650);
^~~~
In the current code, we include the headers that the functions want
according to the man pages, and we define MSG_COPY if its not defined.
We also use 'struct msqid_ds' instead of 'struct msqid64_ds'.
I thought about another patch where I just forward declared these
functions. However, I wasn't happy with that patch since it feels that
it forces user space apps to do the same in order to get this to work.
Another reason was that checkpatch.pl complained that I added forward
declarations in the c file.
Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test")
Signed-off-by: Anders Roxell <anders.roxell(a)linaro.org>
---
tools/testing/selftests/ipc/msgque.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
index ee9382bdfadc..3e32917cd7f4 100644
--- a/tools/testing/selftests/ipc/msgque.c
+++ b/tools/testing/selftests/ipc/msgque.c
@@ -3,11 +3,18 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <linux/msg.h>
#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/msg.h>
+
#include "../kselftest.h"
+#ifndef MSG_COPY
+# define MSG_COPY 040000 /* copy (not remove) all queue messages */
+#endif
+
#define MAX_MSG_SIZE 32
struct msg1 {
@@ -129,7 +136,7 @@ int check_and_destroy_queue(struct msgque_data *msgque)
int dump_queue(struct msgque_data *msgque)
{
- struct msqid64_ds ds;
+ struct msqid_ds ds;
int kern_id;
int i, ret;
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
We miss CONFIG_* fragments so test fib-onlink-tests.sh can do:
ip li add lisa type vrf table 1101
ip li add veth1 type veth peer name veth2
And the follow message occurs if it isn't enabled:
Configuring interfaces
RTNETLINK answers: Operation not supported
This enables for NET_NRF (and friends) and VETH so we can create a vrf
table and veth.
Fixes: 153e1b84f477 ("selftests: Add FIB onlink tests")
Signed-off-by: Anders Roxell <anders.roxell(a)linaro.org>
---
tools/testing/selftests/net/config | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/testing/selftests/net/config b/tools/testing/selftests/net/config
index 7177bea1fdfa..6a75a3ea44ad 100644
--- a/tools/testing/selftests/net/config
+++ b/tools/testing/selftests/net/config
@@ -2,3 +2,8 @@ CONFIG_USER_NS=y
CONFIG_BPF_SYSCALL=y
CONFIG_TEST_BPF=m
CONFIG_NUMA=y
+CONFIG_NET_VRF=y
+CONFIG_NET_L3_MASTER_DEV=y
+CONFIG_IPV6=y
+CONFIG_IPV6_MULTIPLE_TABLES=y
+CONFIG_VETH=y
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
In a -ffreestanding environment without glibc, we shouldn't be able to
call either getenv or printf. It seems that printf() happens to work
fine, but it ends up using the glibc getenv(), which doesn't work unless
we call the glibc _start() function first.
Using _start() was originally meant as an optimization to reduce the
memory consumption of the test program itself, in order to get a more
accurate representation of the available RAM at system boot time.
However, it causes more problems than it helps, especially when run from
a shell script that also consumes some memory.
get_size[2838]: segfault at ffffffffffffffd0 ip 000000000040538b
sp 00007ffc41980668 error 5 in get_size[400000+b0000]
audit: type=1701 audit(1521532923.838:4): auid=0 uid=0 gid=0 ses=2
subj=kernel pid=2838 comm=\"get_size\"
exe=\"/opt/kselftests/next/size/get_size\" sig=11 res=1
get_size[2840]: segfault at ffffffffffffffd0 ip 000000000040538b
sp 00007ffdace9b378 error 5 in get_size[400000+b0000]
audit: type=1701 audit(1521532932.057:5): auid=0 uid=0 gid=0 ses=2
subj=kernel pid=2840 comm=\"get_size\"
exe=\"/opt/kselftests/next/size/get_size\" sig=11 res=1
Rework to get_size test to use main (and printf) instead of _start. All
other seftest tests uses main and not _start.
Fixes: 0081901af95f ("selftests: size call ksft_print_header() to print TAP header")
Signed-off-by: Anders Roxell <anders.roxell(a)linaro.org>
---
tools/testing/selftests/size/Makefile | 2 +-
tools/testing/selftests/size/get_size.c | 47 ++++++++++-----------------------
2 files changed, 15 insertions(+), 34 deletions(-)
diff --git a/tools/testing/selftests/size/Makefile b/tools/testing/selftests/size/Makefile
index 4685b3e421fc..73932e0e7cd0 100644
--- a/tools/testing/selftests/size/Makefile
+++ b/tools/testing/selftests/size/Makefile
@@ -1,4 +1,4 @@
-CFLAGS := -static -ffreestanding -nostartfiles -s
+CFLAGS := -static -ffreestanding -s
TEST_GEN_PROGS := get_size
diff --git a/tools/testing/selftests/size/get_size.c b/tools/testing/selftests/size/get_size.c
index 1280b09266f0..490cf4e26eaf 100644
--- a/tools/testing/selftests/size/get_size.c
+++ b/tools/testing/selftests/size/get_size.c
@@ -26,13 +26,6 @@
#include <stdio.h>
#include "../kselftest.h"
-#define STDOUT_FILENO 1
-
-static int print(const char *s)
-{
- return write(STDOUT_FILENO, s, __builtin_strlen(s));
-}
-
static inline char *num_to_str(unsigned long num, char *buf, int len)
{
unsigned int digit;
@@ -49,30 +42,18 @@ static inline char *num_to_str(unsigned long num, char *buf, int len)
return buf;
}
-static int print_num(unsigned long num)
-{
- char num_buf[30];
-
- return print(num_to_str(num, num_buf, sizeof(num_buf)));
-}
-
static int print_k_value(const char *s, unsigned long num, unsigned long units)
{
unsigned long long temp;
- int ccode;
-
- print(s);
temp = num;
temp = (temp * units)/1024;
num = temp;
- ccode = print_num(num);
- print("\n");
- return ccode;
+ return printf("%s%d\n", s, num);
}
/* this program has no main(), as startup libraries are not used */
-void _start(void)
+int main(void)
{
int ccode;
struct sysinfo info;
@@ -80,28 +61,28 @@ void _start(void)
static const char *test_name = " get runtime memory use\n";
ksft_print_header();
- print("# Testing system size.\n");
+ printf("# Testing system size.\n");
ccode = sysinfo(&info);
if (ccode < 0) {
- print("not ok 1");
- print(test_name);
- print(" ---\n reason: \"could not get sysinfo\"\n ...\n");
- _exit(ccode);
+ printf("not ok 1");
+ printf(test_name);
+ printf(" ---\n reason: \"could not get sysinfo\"\n ...\n");
+ return 1;
}
- print("ok 1");
- print(test_name);
+ printf("ok 1");
+ printf(test_name);
/* ignore cache complexities for now */
used = info.totalram - info.freeram - info.bufferram;
- print("# System runtime memory report (units in Kilobytes):\n");
- print(" ---\n");
+ printf("# System runtime memory report (units in Kilobytes):\n");
+ printf(" ---\n");
print_k_value(" Total: ", info.totalram, info.mem_unit);
print_k_value(" Free: ", info.freeram, info.mem_unit);
print_k_value(" Buffer: ", info.bufferram, info.mem_unit);
print_k_value(" In use: ", used, info.mem_unit);
- print(" ...\n");
- print("1..1\n");
+ printf(" ...\n");
+ printf("1..1\n");
- _exit(0);
+ return 0;
}
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Add top level TAP header echo, testname and separator line to make
the output consistent with the common run_tests target.
This change prevents nested TAP13 headers output from individual tests.
Nested TAP13 headers could cause problems for some parsers.
Signed-off-by: Shuah Khan <shuahkh(a)osg.samsung.com>
---
Changes since v1:
- Add export KSFT_TAP_LEVEL to fix nested TAP header problem
for "make -C" usecase
- Update commit log with details on nested TAP headers.
tools/testing/selftests/futex/Makefile | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests/futex/Makefile b/tools/testing/selftests/futex/Makefile
index cea4adcd42b8..3006febb59fe 100644
--- a/tools/testing/selftests/futex/Makefile
+++ b/tools/testing/selftests/futex/Makefile
@@ -18,6 +18,10 @@ all:
done
override define RUN_TESTS
+ @export KSFT_TAP_LEVEL=`echo 1`;
+ @echo "TAP version 13";
+ @echo "selftests: futex";
+ @echo "========================================";
@cd $(OUTPUT); ./run.sh
endef
--
2.14.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
This patch series is a result discussion with Tim Bird about nested TAP
header handling. Based on the discussion, I am introducing a environment
variable to prevent nested TAP headers. These patches improve the run_tests
output and the output from the script generated by emit_tests.
This first patch in this series adds environment variable KSFT_TAP_LEVEL
to avoid printing nested TAP headers for each test. lib.mk run_tests
target prints TAP header before invoking the test program or test script.
Tests need a way to suppress TAP headers if it is already printed out.
This new environment variable adds a way for ksft_print_header()
print TAP header only when KSFT_TAP_LEVEL isn't set.
The second patch in this series changes lib.mk run_tests target to set
KSFT_TAP_LEVEL before running tests.
The third patch changes Makefile to export KSFT_TAP_LEVEL and adds
TAP and KSFT_TAP_LEVEL handling to emit_tests target.
Forth and fifth patches make changes to size and futex tests to
prevent nested TAP headers to take advantage of the framework
change in the first patch.
Shuah Khan (5):
selftests: kselftest framework: add handling for TAP header level
selftests: lib.mk set KSFT_TAP_LEVEL to prevent nested TAP headers
selftests: Makefile set KSFT_TAP_LEVEL to prevent nested TAP headers
selftests: size call ksft_print_header() to print TAP header
selftests: futex Makefile add top level TAP header echo to RUN_TESTS
tools/testing/selftests/Makefile | 10 +++++++++-
tools/testing/selftests/futex/Makefile | 3 +++
tools/testing/selftests/kselftest.h | 3 ++-
tools/testing/selftests/lib.mk | 1 +
tools/testing/selftests/size/get_size.c | 4 +++-
5 files changed, 18 insertions(+), 3 deletions(-)
--
2.14.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Linus,
Please pull the following Kselftest update for 4.16-rc5.
This kselftest fixes update has a fix for regression in memory-hotplug
install script that prevents the test from running on the target.
Diff for the update is attached.
thanks,
-- Shuah
-----------------------------------------------------------------------------------
The following changes since commit f6869826de700bce59e2cef14974f99836e34e4f:
selftests: vm: update .gitignore with new test (2018-02-26 16:09:50 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-4.16-rc5
for you to fetch changes up to ba004a2955f759946d8c98ca1a9c8d09818b1223:
selftests: memory-hotplug: fix emit_tests regression (2018-03-02 10:12:59 -0700)
----------------------------------------------------------------
linux-kselftest-4.16-rc5
This kselftest fixes update has a fix for regression in memory-hotplug
install script that prevents the test from running on the target.
----------------------------------------------------------------
Shuah Khan (1):
selftests: memory-hotplug: fix emit_tests regression
tools/testing/selftests/memory-hotplug/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
-----------------------------------------------------------------------------------