summaryrefslogtreecommitdiffhomepage
path: root/test
AgeCommit message (Collapse)Author
2019-08-27Fix pwritev2 flaky test.Zach Koopmans
Fix a uninitialized memory bug in pwritev2 test. PiperOrigin-RevId: 265772176
2019-08-27Fix sendfile(2) error codeFabricio Voznika
When output file is in append mode, sendfile(2) should fail with EINVAL and not EBADF. Closes #721 PiperOrigin-RevId: 265718958
2019-08-26Internal change.gVisor bot
PiperOrigin-RevId: 265535438
2019-08-23Second try at flaky futex test.Zach Koopmans
The flake had the call to futex_unlock_pi() returning EINVAL with the FUTEX_OWNER_DIED set. In this case, userspace has to clean up stale state. So instead of calling FUTEX_UNLOCK_PI outright, we'll use the advised atomic compare_exchange as advised in the man page. PiperOrigin-RevId: 265163920
2019-08-22test: set shard_count to 5 by defaultAndrei Vagin
In cl/264434674 and cl/264498919, we stop running test cases in parallel to not overload test hosts. But now tests requires more time to run, so we need to increase a default number of shards or a default test timeout. Let's start with increasing the number of shards and see how it will works. PiperOrigin-RevId: 264917055
2019-08-22Remove ASSERT from fork childMichael Pratt
The gunit macros are not safe to use in the child. PiperOrigin-RevId: 264904348
2019-08-21Support binding to multicast and broadcast addressesChris Kuiper
This fixes the issue of not being able to bind to either a multicast or broadcast address as well as to send and receive data from it. The way to solve this is to treat these addresses similar to the ANY address and register their transport endpoint ID with the global stack's demuxer rather than the NIC's. That way there is no need to require an endpoint with that multicast or broadcast address. The stack's demuxer is in fact the only correct one to use, because neither broadcast- nor multicast-bound sockets care which NIC a packet was received on (for multicast a join is still needed to receive packets on a NIC). I also took the liberty of refactoring udp_test.go to consolidate a lot of duplicate code and make it easier to create repetitive tests that test the same feature for a variety of packet and socket types. For this purpose I created a "flowType" that represents two things: 1) the type of packet being sent or received and 2) the type of socket used for the test. E.g., a "multicastV4in6" flow represents a V4-mapped multicast packet run through a V6-dual socket. This allows writing significantly simpler tests. A nice example is testTTL(). PiperOrigin-RevId: 264766909
2019-08-21tests: retry connect if it fails with EINTRAndrei Vagin
test/syscalls/linux/proc_net_tcp.cc:252: Failure Value of: connect(client->get(), &addr, addrlen) Expected: not -1 (success) Actual: -1 (of type int), with errno PosixError(errno=4 Interrupted system call) PiperOrigin-RevId: 264743815
2019-08-20test: reset a signal handler before closing a signal channelAndrei Vagin
goroutine 5 [running]: os/signal.process(0x10e21c0, 0xc00050c280) third_party/go/gc/src/os/signal/signal.go:227 +0x164 os/signal.loop() third_party/go/gc/src/os/signal/signal_unix.go:23 +0x3e created by os/signal.init.0 third_party/go/gc/src/os/signal/signal_unix.go:29 +0x41 PiperOrigin-RevId: 264518530
2019-08-20Don't run runtime tests in parallel.Nicolas Lacasse
We need real sharding, and will let Bazel handle the parallelization. That is coming soon. Until then, remove this call to t.Parallel() so that we can run the tests without eating all CPU. PiperOrigin-RevId: 264498919
2019-08-20Add tests for raw AF_PACKET sockets.Kevin Krakauer
PiperOrigin-RevId: 264494359
2019-08-20Fix flaky futex test.Zach Koopmans
The test is long running (175128 ms or so) which causes timeouts. The test simply makes sure that private futexes can acquire locks concurrently. Dropping current threads and increasing the number of locks each thread tests the same concurrency concerns but drops execution time to ~1411 ms. PiperOrigin-RevId: 264476144
2019-08-20tests: syscall_test_runner should not run tests in parallelAndrei Vagin
bazel runs a few instances of syscall_test_runner in parallel and then syscall_test_runner runs test cases in parallel. It might be a reason why we see that test hosts are overloaded and sandboxes start slowly. It should be better to control how many tests are running in parallel from one place, so let's try to disable this feature in syscall_test_runner. PiperOrigin-RevId: 264434674
2019-08-19Read iptables via sockopts.Kevin Krakauer
PiperOrigin-RevId: 264180125
2019-08-16netstack: disconnect an unix socket only if the address family is AF_UNSPECAndrei Vagin
Linux allows to call connect for ANY and the zero port. PiperOrigin-RevId: 263892534
2019-08-15Add tests for "cooked" AF_PACKET sockets.Kevin Krakauer
PiperOrigin-RevId: 263666789
2019-08-14Improve SendMsg performance.Bhasker Hariharan
SendMsg before this change would copy all the data over into a new slice even if the underlying socket could only accept a small amount of data. This is really inefficient with non-blocking sockets and under high throughput where large writes could get ErrWouldBlock or if there was say a timeout associated with the sendmsg() syscall. With this change we delay copying bytes in till they are needed and only copy what can be potentially sent/held in the socket buffer. Reducing the need to repeatedly copy data over. Also a minor fix to change state FIN-WAIT-1 when shutdown(..., SHUT_WR) is called instead of when we transmit the actual FIN. Otherwise the socket could remain in CONNECTED state even though the user has called shutdown() on the socket. Updates #627 PiperOrigin-RevId: 263430505
2019-08-13tests: print stack traces if test failed by timeoutAndrei Vagin
PiperOrigin-RevId: 263184083
2019-08-13Bump Bazel to v0.28.0Nicolas Lacasse
The new version has a change in behavior when using a custom platform: * Old behavior: rules that don't require a toolchain used host_platform, no matter what execution platforms are specified. * New behavior: rules that don't require a toolchain use standard platform resolution that starts with execution platforms. As part of this change, we cannot use the "extra_exectution_platforms" flag provided by the default bazelrc. I got rid of the default bazelrc file, and made our custom .bazelrc as minimal as possible. PiperOrigin-RevId: 263176802
2019-08-12Compute size of struct tcp_info instead of hardcoding it.Rahat Mahmood
PiperOrigin-RevId: 263040624
2019-08-09netlink: return an error in nlmsgerrAndrei Vagin
Now if a process sends an unsupported netlink requests, an error is returned from the send system call. The linux kernel works differently in this case. It returns errors in the nlmsgerr netlink message. Reported-by: syzbot+571d99510c6f935202da@syzkaller.appspotmail.com PiperOrigin-RevId: 262690453
2019-08-09Create tests for common.Search().Brett Landau
Using the path_test.go file built by the Golang devs as a base, tests have been created to verify the functionality of common.Search(). A mock file system is created and fake test files are generated to see if they get picked up by common.Search(). Also included in this CL is a bug fix for proctor-nodejs that was discovered using this test. proctor-nodejs used to allow multiple "-" in its test name filter. The regex has been updated to prevent this. PiperOrigin-RevId: 262647263
2019-08-06Fix for a panic due to writing to a closed accept channel.Bhasker Hariharan
This can happen because endpoint.Close() closes the accept channel first and then drains/resets any accepted but not delivered connections. But there can be connections that are connected but not delivered to the channel as the channel was full. But closing the channel can cause these writes to fail with a write to a closed channel. The correct solution is to abort any connections in SYN-RCVD state and drain/abort all completed connections before closing the accept channel. PiperOrigin-RevId: 261951132
2019-08-06Require pread/pwrite for splice file offsetsMichael Pratt
If there is an offset, the file must support pread/pwrite. See fs/splice.c:do_splice. PiperOrigin-RevId: 261944932
2019-08-05Alter Dockerfiles to include common.go and use a prebuilt JDK.Samantha Sample
After the refactoring of the proctor binaries, the Dockerfiles for each language must be altered to copy the common folder into their image. Additionally, Java has been changed to use the pre-built version of JDK-11 from Ubuntu, instead of building it from the source. This allows for a smaller image and faster test execution within the container. PiperOrigin-RevId: 261805158
2019-08-05Expand runtimes test suite to include Go, Java, PHP, and Python.Samantha Sample
This change adds functionality for running more languages using the runtimes test suite. It divides the languages into separate test functions, which each call the helper testLang function in the runtimes_test.go file. This allows them to be run individually or as a group. PiperOrigin-RevId: 261791935
2019-08-02Job control: controlling TTYs and foreground process groups.Kevin Krakauer
(Don't worry, this is mostly tests.) Implemented the following ioctls: - TIOCSCTTY - set controlling TTY - TIOCNOTTY - remove controlling tty, maybe signal some other processes - TIOCGPGRP - get foreground process group. Also enables tcgetpgrp(). - TIOCSPGRP - set foreground process group. Also enabled tcsetpgrp(). Next steps are to actually turn terminal-generated control characters (e.g. C^c) into signals to the proper process groups, and to send SIGTTOU and SIGTTIN when appropriate. PiperOrigin-RevId: 261387276
2019-08-02Automated rollback of changelist 261191548Rahat Mahmood
PiperOrigin-RevId: 261373749
2019-08-01Refactor ListTests() to common.Search().Brett Landau
This change removes the filepath.Walk() function from proctor- go, php, and nodejs. The filepath.Walk() is now defined in common.go in Search(). Each proctor binary passes root directory and testFilter arguments to Search(). proctor-python.go no longer uses filepath.Walk() to search for tests. There is a built-in list test function within python's language test suite so that is being used instead. PiperOrigin-RevId: 261242897
2019-08-01Implement getsockopt(TCP_INFO).Rahat Mahmood
Export some readily-available fields for TCP_INFO and stub out the rest. PiperOrigin-RevId: 261191548
2019-07-31Basic support for 'ip route'Ian Lewis
Implements support for RTM_GETROUTE requests for netlink sockets. Fixes #507 PiperOrigin-RevId: 261051045
2019-07-31Fix test execution bugs in proctor-go and proctor-python.Brett Landau
proctor-go had a bug where it would incorrectly identify a tool test as a disk test. Instead of searching for the test on disk as the identification method, we now check if the test name ends in ".go". If the test ends in ".go" it is run as a disk test, otherwise the test is run as a tool test. Python tests need to be run from within the directory they exist. Functionality to split the test name from it's parent directory has been added and a cmd.Dir argument has been set. PiperOrigin-RevId: 261021693
2019-07-31Refactor proctor binaries to implement testRunner interface.Brett Landau
Shared code among proctor-*.go files has been refactored into common/common.go. The common package is imported in each proctor binary and a struct is created to implement the testRunner interface defined in common.go. This allows for the proctor binaries to be updated without having to copy/paste the same code across all files. There are no usage or functionality changes. PiperOrigin-RevId: 260967080
2019-07-31Fix ICMPv4 EchoReply packet checksumAustin Kiekintveld
The checksum was not being reset before being re-calculated and sent out. This caused the sent checksum to always be `0x0800`. Fixes #605. PiperOrigin-RevId: 260965059
2019-07-31Test connecting UDP sockets to the ANY addressTamir Duberstein
This doesn't currently pass on gVisor. While I'm here, fix a bug where connecting to the v6-mapped v4 address doesn't work in gVisor. PiperOrigin-RevId: 260923961
2019-07-29Fix flaky stat.cc test.Zach Koopmans
This test flaked on my current CL. Linux makes no guarantee that two inodes will consecutive (overflows happen). https://github.com/avagin/linux-task-diag/blob/master/fs/inode.c#L880 PiperOrigin-RevId: 260608240
2019-07-29Move runtimes tests to appropriate directory.Samantha Sample
PiperOrigin-RevId: 260577765
2019-07-29Add iptables types for syscalls tests.Kevin Krakauer
Unfortunately, Linux's ip_tables.h header doesn't compile in C++ because it implicitly converts from void* to struct xt_entry_target*. C allows this, but C++ does not. So we have to re-implement many types ourselves. Relevant code here: https://github.com/torvalds/linux/blob/master/include/uapi/linux/netfilter_ipv4/ip_tables.h#L222 PiperOrigin-RevId: 260565570
2019-07-25Automated rollback of changelist 255679453Fabricio Voznika
PiperOrigin-RevId: 260047477
2019-07-23Deduplicate EndpointState.connected someTamir Duberstein
This fixes a bug introduced in cl/251934850 that caused connect-accept-close-connect races to result in the second connect call failiing when it should have succeeded. PiperOrigin-RevId: 259584525
2019-07-19Merge pull request #450 from Pixep:feature/add-clock-boottime-as-monotonicgVisor bot
PiperOrigin-RevId: 258996346
2019-07-19Handle interfaceAddr and NIC options separately for IP_MULTICAST_IFChris Kuiper
This tweaks the handling code for IP_MULTICAST_IF to ignore the InterfaceAddr if a NICID is given. PiperOrigin-RevId: 258982541
2019-07-18net/tcp/setockopt: impelment setsockopt(fd, SOL_TCP, TCP_INQ)Andrei Vagin
PiperOrigin-RevId: 258859507
2019-07-17Add AF_UNIX, SOCK_RAW sockets, which exist for some reason.Kevin Krakauer
tcpdump creates these. PiperOrigin-RevId: 258611829
2019-07-17Merge pull request #533 from kevinGC:stub-dev-ttygVisor bot
PiperOrigin-RevId: 258607547
2019-07-17Properly invalidate cache in rename and removeMichael Pratt
We were invalidating the wrong overlayEntry in rename and missing invalidation in rename and remove if lower exists. PiperOrigin-RevId: 258604685
2019-07-16Add CLOCK_BOOTTIME tests to timerfd.ccAdrien Leravat
2019-07-16Internal change.gVisor bot
PiperOrigin-RevId: 258424489
2019-07-15Replace vector of arrays with array of arrays.Kevin Krakauer
C++ does not like vectors of arrays (because arrays are not copy-constructable). PiperOrigin-RevId: 258270980
2019-07-15Fix initialization of badhandler_low_water_mark in SigaltstackTest.Neel Natu
It is now correctly initialized to the top of the signal stack. Previously it was initialized to the address of 'stack.ss_sp' on the main thread stack. PiperOrigin-RevId: 258248363