diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-04-28 20:24:36 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-04-28 20:24:36 +0000 |
commit | ae0c9b6f58eb9145a00c97924e6898c516ef6a1c (patch) | |
tree | 02655f29619ed06cf48fa53aaecf032fb3fed0da | |
parent | 87284ac7c49a277113609d0d9561742dbab086b4 (diff) | |
parent | 765503ee2a99b865dc7bba30219408238ae61a8b (diff) | |
download | tests-ae0c9b6f58eb9145a00c97924e6898c516ef6a1c.tar.gz |
Snap for 6439596 from 765503ee2a99b865dc7bba30219408238ae61a8b to qt-aml-tzdata-releaseandroid-mainline-10.0.0_r11
Change-Id: I3367b79afc6cc87f1c552efaf5f48aaa99328db4
-rwxr-xr-x | net/test/build_all_rootfs.sh | 2 | ||||
-rwxr-xr-x | net/test/build_rootfs.sh | 8 | ||||
-rwxr-xr-x | net/test/leak_test.py | 12 | ||||
-rwxr-xr-x | net/test/net_test.sh | 13 | ||||
-rw-r--r-- | net/test/rootfs/buster.list | 33 | ||||
-rwxr-xr-x | net/test/rootfs/buster.sh | 128 | ||||
-rwxr-xr-x | net/test/rootfs/stretch.sh | 3 | ||||
-rwxr-xr-x | net/test/run_net_test.sh | 29 | ||||
-rwxr-xr-x | net/test/tcp_nuke_addr_test.py | 2 |
9 files changed, 24 insertions, 206 deletions
diff --git a/net/test/build_all_rootfs.sh b/net/test/build_all_rootfs.sh index 54ebde1..98a4918 100755 --- a/net/test/build_all_rootfs.sh +++ b/net/test/build_all_rootfs.sh @@ -17,7 +17,7 @@ set -e -for s in wheezy stretch buster; do +for s in wheezy stretch; do for a in i386 amd64 armhf arm64; do # Debian wheezy does not support arm64 architecture diff --git a/net/test/build_rootfs.sh b/net/test/build_rootfs.sh index e92a8f9..72e9598 100755 --- a/net/test/build_rootfs.sh +++ b/net/test/build_rootfs.sh @@ -20,14 +20,14 @@ set -e SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P) usage() { - echo -n "usage: $0 [-h] [-s wheezy|stretch|buster] [-a i386|amd64|armhf|arm64] " + echo -n "usage: $0 [-h] [-s wheezy|stretch] [-a i386|amd64|armhf|arm64] " echo "[-m http://mirror/debian] [-n net_test.rootfs.`date +%Y%m%d`]" exit 1 } mirror=http://ftp.debian.org/debian debootstrap=debootstrap -suite=buster +suite=stretch arch=amd64 while getopts ":hs:a:m:n:" opt; do @@ -36,9 +36,7 @@ while getopts ":hs:a:m:n:" opt; do usage ;; s) - if [ "$OPTARG" != "wheezy" -a \ - "$OPTARG" != "stretch" -a \ - "$OPTARG" != "buster" ]; then + if [ "$OPTARG" != "wheezy" -a "$OPTARG" != "stretch" ]; then echo "Invalid suite: $OPTARG" >&2 usage fi diff --git a/net/test/leak_test.py b/net/test/leak_test.py index 8a42611..8ef4b41 100755 --- a/net/test/leak_test.py +++ b/net/test/leak_test.py @@ -65,18 +65,18 @@ class ForceSocketBufferOptionTest(net_test.NetworkTest): s.setsockopt(SOL_SOCKET, force_option, val) self.assertEquals(2 * val, s.getsockopt(SOL_SOCKET, option)) - # Check that the force option sets at least the minimum value instead - # of a negative value on integer overflow. Because the kernel multiplies - # passed-in values by 2, pick a value that becomes a small negative number - # if treated as unsigned. + # Check that the force option sets the minimum value instead of a negative + # value on integer overflow. Because the kernel multiplies passed-in values + # by 2, pick a value that becomes a small negative number if treated as + # unsigned. bogusval = 2 ** 31 - val s.setsockopt(SOL_SOCKET, force_option, bogusval) - self.assertLessEqual(minbuf, s.getsockopt(SOL_SOCKET, option)) + self.assertEquals(minbuf, s.getsockopt(SOL_SOCKET, option)) def testRcvBufForce(self): self.CheckForceSocketBufferOption(SO_RCVBUF, self.SO_RCVBUFFORCE) - def testSndBufForce(self): + def testRcvBufForce(self): self.CheckForceSocketBufferOption(SO_SNDBUF, self.SO_SNDBUFFORCE) diff --git a/net/test/net_test.sh b/net/test/net_test.sh index 9b9773e..72c67a9 100755 --- a/net/test/net_test.sh +++ b/net/test/net_test.sh @@ -17,23 +17,14 @@ if [[ -n "${verbose}" ]]; then echo fi -if [[ "$(tty)" == 'not a tty' ]]; then - echo 'not a tty? perhaps not quite real kernel default /dev/console - trying to fix.' - if [[ -c /dev/console ]]; then - [[ "$(readlink /proc/$$/fd/0)" != '/dev/console' ]] || exec < /dev/console - [[ "$(readlink /proc/$$/fd/1)" != '/dev/console' ]] || exec > /dev/console - [[ "$(readlink /proc/$$/fd/2)" != '/dev/console' ]] || exec 2> /dev/console - fi -fi - if [[ "$(tty)" == '/dev/console' ]]; then ARCH="$(uname -m)" # Underscore is illegal in hostname, replace with hyphen ARCH="${ARCH//_/-}" # setsid + /dev/tty{,AMA,S}0 allows bash's job control to work, ie. Ctrl+C/Z - if [[ -e '/proc/exitcode' ]]; then - # exists only in UML + if [[ -c '/dev/tty0' ]]; then + # exists in UML, does not exist on graphics/vga/curses-less QEMU CON='/dev/tty0' hostname "uml-${ARCH}" elif [[ -c '/dev/ttyAMA0' ]]; then diff --git a/net/test/rootfs/buster.list b/net/test/rootfs/buster.list deleted file mode 100644 index fbeddde..0000000 --- a/net/test/rootfs/buster.list +++ /dev/null @@ -1,33 +0,0 @@ -apt -apt-utils -bash-completion -bsdmainutils -ca-certificates -file -gpgv -ifupdown -insserv -iputils-ping -less -libnetfilter-conntrack3 -libnfnetlink0 -mime-support -netbase -netcat-openbsd -netcat-traditional -net-tools -openssl -pciutils -procps -psmisc -python -python-scapy -strace -systemd-sysv -tcpdump -traceroute -udev -udhcpc -usbutils -vim-tiny -wget diff --git a/net/test/rootfs/buster.sh b/net/test/rootfs/buster.sh deleted file mode 100755 index c3030a0..0000000 --- a/net/test/rootfs/buster.sh +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -set -e - -SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P) - -. $SCRIPT_DIR/common.sh - -chroot_sanity_check - -cd /root - -# Add the needed debian sources -cat >/etc/apt/sources.list <<EOF -deb http://ftp.debian.org/debian buster main -deb-src http://ftp.debian.org/debian buster main -EOF - -# Disable the automatic installation of recommended packages -cat >/etc/apt/apt.conf.d/90recommends <<EOF -APT::Install-Recommends "0"; -EOF - -# Update for the above changes -apt-get update - -# Note what we have installed; we will go back to this -LANG=C dpkg --get-selections | sort >originally-installed - -# Install everything needed from buster to build iptables -apt-get install -y \ - build-essential \ - autoconf \ - automake \ - bison \ - debhelper \ - devscripts \ - fakeroot \ - flex \ - libmnl-dev \ - libnetfilter-conntrack-dev \ - libnfnetlink-dev \ - libnftnl-dev \ - libtool - -# We are done with apt; reclaim the disk space -apt-get clean - -# Construct the iptables source package to build -iptables=iptables-1.6.1 -mkdir -p /usr/src/$iptables - -cd /usr/src/$iptables -# Download a specific revision of iptables from AOSP -wget -qO - \ - https://android.googlesource.com/platform/external/iptables/+archive/master.tar.gz | \ - tar -zxf - -# Download a compatible 'debian' overlay from Debian salsa -# We don't want all of the sources, just the Debian modifications -debian_iptables=1.6.1-2_bpo9+1 -debian_iptables_dir=pkg-iptables-debian-$debian_iptables -wget -qO - \ - https://salsa.debian.org/pkg-netfilter-team/pkg-iptables/-/archive/debian/$debian_iptables/$debian_iptables_dir.tar.gz | \ - tar --strip-components 1 -zxf - \ - $debian_iptables_dir/debian -cd - - -cd /usr/src -# Generate a source package to leave in the filesystem. This is done for license -# compliance and build reproducibility. -tar --exclude=debian -cf - $iptables | \ - xz -9 >`echo $iptables | tr -s '-' '_'`.orig.tar.xz -cd - - -cd /usr/src/$iptables -# Build debian packages from the integrated iptables source -dpkg-buildpackage -F -us -uc -cd - - -# Record the list of packages we have installed now -LANG=C dpkg --get-selections | sort >installed - -# Compute the difference, and remove anything installed between the snapshots -dpkg -P `comm -3 originally-installed installed | sed -e 's,install,,' -e 's,\t,,' | xargs` - -cd /usr/src -# Find any packages generated, resolve to the debian package name, then -# exclude any compat, header or symbol packages -packages=`find -maxdepth 1 -name '*.deb' | colrm 1 2 | cut -d'_' -f1 | - grep -ve '-compat$\|-dbg$\|-dbgsym$\|-dev$' | xargs` -# Install the patched iptables packages, and 'hold' then so -# "apt-get dist-upgrade" doesn't replace them -dpkg -i ` -for package in $packages; do - echo ${package}_*.deb -done | xargs` -for package in $packages; do - echo "$package hold" | dpkg --set-selections -done -# Tidy up the mess we left behind, leaving just the source tarballs -rm -rf $iptables *.buildinfo *.changes *.deb *.dsc -cd - - -# Ensure a getty is spawned on ttyS0, if booting the image manually -ln -s /lib/systemd/system/serial-getty\@.service \ - /etc/systemd/system/getty.target.wants/serial-getty\@ttyS0.service - -# systemd needs some directories to be created -mkdir -p /var/lib/systemd/coredump /var/lib/systemd/rfkill \ - /var/lib/systemd/timesync - -# Finalize and tidy up the created image -chroot_cleanup diff --git a/net/test/rootfs/stretch.sh b/net/test/rootfs/stretch.sh index 1819777..6d8a9a4 100755 --- a/net/test/rootfs/stretch.sh +++ b/net/test/rootfs/stretch.sh @@ -89,8 +89,9 @@ mkdir -p /usr/src/$iptables cd /usr/src/$iptables # Download a specific revision of iptables from AOSP +aosp_iptables=android-wear-p-preview-2 wget -qO - \ - https://android.googlesource.com/platform/external/iptables/+archive/master.tar.gz | \ + https://android.googlesource.com/platform/external/iptables/+archive/$aosp_iptables.tar.gz | \ tar -zxf - # Download a compatible 'debian' overlay from Debian salsa # We don't want all of the sources, just the Debian modifications diff --git a/net/test/run_net_test.sh b/net/test/run_net_test.sh index 5e20bae..deed5cd 100755 --- a/net/test/run_net_test.sh +++ b/net/test/run_net_test.sh @@ -13,7 +13,6 @@ EOF # Common kernel options OPTIONS=" DEBUG_SPINLOCK DEBUG_ATOMIC_SLEEP DEBUG_MUTEXES DEBUG_RT_MUTEXES" -OPTIONS="$OPTIONS WARN_ALL_UNSEEDED_RANDOM IKCONFIG IKCONFIG_PROC" OPTIONS="$OPTIONS DEVTMPFS DEVTMPFS_MOUNT FHANDLE" OPTIONS="$OPTIONS IPV6 IPV6_ROUTER_PREF IPV6_MULTIPLE_TABLES IPV6_ROUTE_INFO" OPTIONS="$OPTIONS TUN SYN_COOKIES IP_ADVANCED_ROUTER IP_MULTIPLE_TABLES" @@ -30,7 +29,7 @@ OPTIONS="$OPTIONS NETFILTER_XT_MATCH_QUOTA2" OPTIONS="$OPTIONS NETFILTER_XT_MATCH_QUOTA2_LOG" OPTIONS="$OPTIONS NETFILTER_XT_MATCH_SOCKET" OPTIONS="$OPTIONS NETFILTER_XT_MATCH_QTAGUID" -OPTIONS="$OPTIONS INET_DIAG INET_UDP_DIAG INET_DIAG_DESTROY" +OPTIONS="$OPTIONS INET_UDP_DIAG INET_DIAG_DESTROY" OPTIONS="$OPTIONS IP_SCTP" OPTIONS="$OPTIONS IP_NF_TARGET_REJECT IP_NF_TARGET_REJECT_SKERR" OPTIONS="$OPTIONS IP6_NF_TARGET_REJECT IP6_NF_TARGET_REJECT_SKERR" @@ -41,7 +40,6 @@ OPTIONS="$OPTIONS INET_XFRM_MODE_TUNNEL INET6_ESP" OPTIONS="$OPTIONS INET6_XFRM_MODE_TRANSPORT INET6_XFRM_MODE_TUNNEL" OPTIONS="$OPTIONS CRYPTO_SHA256 CRYPTO_SHA512 CRYPTO_AES_X86_64 CRYPTO_NULL" OPTIONS="$OPTIONS CRYPTO_GCM CRYPTO_ECHAINIV NET_IPVTI" -OPTIONS="$OPTIONS DUMMY" # Kernel version specific options OPTIONS="$OPTIONS XFRM_INTERFACE" # Various device kernels @@ -59,8 +57,8 @@ OPTIONS="$OPTIONS NETFILTER_TPROXY" # Removed in 3.11 OPTIONS="$OPTIONS BLK_DEV_UBD HOSTFS" # QEMU specific options -OPTIONS="$OPTIONS PCI VIRTIO VIRTIO_PCI VIRTIO_BLK NET_9P NET_9P_VIRTIO 9P_FS" -OPTIONS="$OPTIONS CRYPTO_DEV_VIRTIO SERIAL_8250 SERIAL_8250_PCI" +OPTIONS="$OPTIONS VIRTIO VIRTIO_PCI VIRTIO_BLK NET_9P NET_9P_VIRTIO 9P_FS" +OPTIONS="$OPTIONS SERIAL_8250 SERIAL_8250_PCI" # Obsolete options present at some time in Android kernels OPTIONS="$OPTIONS IP_NF_TARGET_REJECT_SKERR IP6_NF_TARGET_REJECT_SKERR" @@ -90,7 +88,7 @@ URL=https://dl.google.com/dl/android/$COMPRESSED_ROOTFS # Parse arguments and figure out which test to run. ARCH=${ARCH:-um} -J=${J:-$(nproc)} +J=${J:-64} MAKE="make" OUT_DIR=$(readlink -f ${OUT_DIR:-.}) KERNEL_DIR=$(readlink -f ${KERNEL_DIR:-.}) @@ -277,7 +275,7 @@ if (( verbose == 1 )); then cmdline="$cmdline verbose=1" fi -cmdline="$cmdline panic=1 init=/sbin/net_test.sh" +cmdline="$cmdline init=/sbin/net_test.sh" cmdline="$cmdline net_test_args=\"$test_args\" net_test_mode=$testmode" if [ "$ARCH" == "um" ]; then @@ -325,14 +323,13 @@ if [ "$ARCH" == "um" ]; then zcat "/boot/config-$(uname -r).gz" || : } 2>/dev/null \ | egrep -q '^CONFIG_LEGACY_VSYSCALL_NONE=y' \ - && ! egrep -q '(^| )vsyscall=(native|emulate|xonly)( |$)' /proc/cmdline \ + && ! egrep -q '(^| )vsyscall=(native|emulate)( |$)' /proc/cmdline \ && { echo -e "\r" echo -e "-----=====-----\r" echo -e "If above you saw a 'net_test.sh[1]: segfault at ...' followed by\r" echo -e "'Kernel panic - not syncing: Attempted to kill init!' then please\r" echo -e "set 'vsyscall=emulate' on *host* kernel command line.\r" - echo -e "On Linux 5.2+ you can instead use the slightly safer 'vsyscall=xonly'.\r" echo -e "(for example via GRUB_CMDLINE_LINUX in /etc/default/grub)\r" echo -e "-----=====-----\r" } @@ -370,21 +367,14 @@ else # Assume we have hardware-accelerated virtualization support for amd64 qemu="qemu-system-x86_64 -machine pc,accel=kvm -cpu host" - # We know 'ttyS0' will be our serial port on x86 from the hard-coded - # '-serial mon:stdio' flag below - cmdline="$cmdline console=ttyS0" - - # The assignment of 'ttyS1' here is magical; we know ttyS0 was used up - # by '-serial mon:stdio', and so this second serial port will be 'ttyS1' + # The assignment of 'ttyS1' here is magical -- we know 'ttyS0' will be our + # serial port from the hard-coded '-serial stdio' flag below, and so this + # second serial port will be 'ttyS1'. cmdline="$cmdline net_test_exitcode=/dev/ttyS1" elif [ "$ARCH" == "arm64" ]; then # This uses a software model CPU, based on cortex-a57 qemu="qemu-system-aarch64 -machine virt -cpu cortex-a57" - # We know 'ttyAMA0' will be our serial port on arm64 from the hard-coded - # '-serial mon:stdio' flag below - cmdline="$cmdline console=ttyAMA0" - # The kernel will print messages via a virtual ARM serial port (ttyAMA0), # but for command line consistency with x86, we put the exitcode serial # port on the PCI bus, and it will be the only one. @@ -409,7 +399,6 @@ fi # UML reliably screws up the ptys, QEMU probably can as well... fixup_ptys stty sane || : -tput smam || : echo "Returning exit code ${exitcode}." 1>&2 exit "${exitcode}" diff --git a/net/test/tcp_nuke_addr_test.py b/net/test/tcp_nuke_addr_test.py index 1f0de76..deb4012 100755 --- a/net/test/tcp_nuke_addr_test.py +++ b/net/test/tcp_nuke_addr_test.py @@ -105,7 +105,7 @@ class TcpNukeAddrTest(net_test.NetworkTest): def testIpv6Unsupported(self): self.CheckNukeAddrUnsupported(CreateIPv6SocketPair(), IPV6_LOOPBACK_ADDR) - self.CheckNukeAddrUnsupported(CreateIPv6SocketPair(), "::") + self.CheckNukeAddrUnsupported(CreateIPv4SocketPair(), "::") if __name__ == "__main__": |