tests/tcg: add write tests for nbyte = 0
RFC PATCH 1/1 tests/tcg: add write tests for nbyte = 0
rename linux-test so we can get both (32 and 64 bit) versions in a multilib x86 host.
published as an RFC since the include options that were needed to fix the build will most likely conflict with scripts/clean-includes
make check is unaffected by this new test (which fails in x86_64) and the rule to automatically run it against qemu-user and diff has been left out in purpose, not to affect any user of the remaining surrounding tests, but discussion on how to get tests/tcg back in shape, or if linux-user should be tested somewhere else is also encouraged
--- include/qemu/cutils.h | 2 ++ include/qemu/fprintf-fn.h | 2 ++ tests/tcg/Makefile | 11 +++++++---- tests/tcg/linux-test.c | 9 ++++++++- 4 files changed, 19 insertions(+), 5 deletions(-)
include/qemu/cutils.h +2 -0
@@ -1,6 +1,8 @@#ifndef QEMU_CUTILS_H #define QEMU_CUTILS_H +#include <stdbool.h> +#include "qemu/fprintf-fn.h" /**
include/qemu/fprintf-fn.h +2 -0
@@ -8,6 +8,8 @@#ifndef QEMU_FPRINTF_FN_H #define QEMU_FPRINTF_FN_H +#include "compiler.h" + typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)GCC_FMT_ATTR (2 ,3 );
tests/tcg/Makefile +7 -4
@@ -18,7 +18,7 @@ LDFLAGS= # also, pi_10.com runs indefinitely I386_TESTS=hello-i386 \ - linux-test \ + linux-test-i386 \ testthread \ sha1-i386 \ test-i386 \
@@ -47,7 +47,7 @@ run-%: % -$(QEMU) ./$* run-hello-i386: hello-i386 -run-linux-test: linux-test +run-linux-test-i386: linux-test-i386 run-testthread: testthread run-sha1-i386: sha1-i386
@@ -105,8 +105,11 @@ test-x86_64: test-i386.c \ $(CC_X86_64) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $(<D)/test-i386.c -lm # generic Linux and CPU test -linux-test: linux-test.c - $(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm +linux-test-i386: linux-test.c + $(CC_I386) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm + +linux-test-x86_64: linux-test.c + $(CC_X86_64) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm # vm86 test runcom: runcom.c
tests/tcg/linux-test.c +8 -1
@@ -39,6 +39,7 @@#include <dirent.h> #include <setjmp.h> #include <sys/shm.h> +#include <sys/resource.h> #include "qemu/cutils.h" #define TESTPATH "/tmp/linux-test.tmp"
@@ -107,6 +108,12 @@ void test_file(void) len =chk_error (write (fd, buf,FILE_BUF_SIZE /2 ));if (len != (FILE_BUF_SIZE /2 ))error ("write" ); + len =chk_error (write (fd, buf,0 )); +if (len !=0 ) +error ("write 0 size" ); + len =chk_error (write (fd,NULL ,0 )); +if (len !=0 ) +error ("write NULL buf" ); vecs[0 ].iov_base = buf + (FILE_BUF_SIZE /2 ); vecs[0 ].iov_len =16 ; vecs[1 ].iov_base = buf + (FILE_BUF_SIZE /2 ) +16 ;
@@ -533,7 +540,7 @@ int main(int argc, char **argv)test_time ();test_socket ();// test_clone(); -test_signal (); +//test_signal(); test_shm ();return 0 ; }
Signature · 1 line
2.14.2
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [RFC PATCH] tests/tcg: add write tests for nbyte = 0
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test'e1a45b2a8f tests/tcg: add write tests for nbyte = 0
=== OUTPUT BEGIN ===
Checking PATCH 1/1: tests/tcg: add write tests for nbyte = 0...
ERROR: braces {} are necessary for all arms of this statement #103: FILE: tests/tcg/linux-test.c:112:
+ if (len != 0)
[...]
ERROR: braces {} are necessary for all arms of this statement #106: FILE: tests/tcg/linux-test.c:115:
+ if (len != 0)
[...]
ERROR: code indent should never use tabs
#107: FILE: tests/tcg/linux-test.c:116:
+^Ierror("write NULL buf");$
ERROR: do not use C99 // comments
#116: FILE: tests/tcg/linux-test.c:543:
+ //test_signal();
total: 4 errors, 0 warnings, 72 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]