Fix net tests for 32-bit kernel
- Add bpf syscall number for arm7l.
- Ignore non-numeric suffix of kernel version.
Bug: 110440652
Test: run vts -m VtsKernelNetTest
Change-Id: Idd7f278b7f801296957c2a5b2fd092e8ba34da69
Merged-In: If217c961fdd45b013a7d83967bcab8c746804b97
diff --git a/net/test/bpf.py b/net/test/bpf.py
index c9ad264..5e90daa 100755
--- a/net/test/bpf.py
+++ b/net/test/bpf.py
@@ -26,6 +26,7 @@
# TODO: is there a better way of doing this?
__NR_bpf = {
"aarch64": 280,
+ "armv7l": 386,
"armv8l": 386,
"x86_64": 321}[os.uname()[4]]
diff --git a/net/test/csocket.py b/net/test/csocket.py
index bdd501c..ccabf4a 100644
--- a/net/test/csocket.py
+++ b/net/test/csocket.py
@@ -17,6 +17,7 @@
import ctypes
import ctypes.util
import os
+import re
import socket
import struct
@@ -78,9 +79,9 @@
# TODO: Unlike most of this file, these functions aren't specific to wrapping C
# library calls. Move them to a utils.py or constants.py file, once we have one.
def LinuxVersion():
- # Example: "3.4.67-00753-gb7a556f".
- # Get the part before the dash.
- version = os.uname()[2].split("-")[0]
+ # Example: "3.4.67-00753-gb7a556f", "4.4.135+".
+ # Get the prefix consisting of digits and dots.
+ version = re.search("^[0-9.]*", os.uname()[2]).group()
# Convert it into a tuple such as (3, 4, 67). That allows comparing versions
# using < and >, since tuples are compared lexicographically.
version = tuple(int(i) for i in version.split("."))