mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Bump Python runtime tests to Python 3.12.3.
Also reduce the parallelism on BuildKite for this test. It should suffice to run on just 2 agents. PiperOrigin-RevId: 635619602
This commit is contained in:
@@ -534,8 +534,8 @@ steps:
|
||||
- <<: *common
|
||||
<<: *docker
|
||||
label: ":python: Python runtime tests"
|
||||
command: make python3.10.2-runtime-tests RUNTIME_ARGS=--directfs
|
||||
parallelism: 10
|
||||
command: make python3.12.3-runtime-tests RUNTIME_ARGS=--directfs
|
||||
parallelism: 2
|
||||
agents:
|
||||
<<: *platform_specific_agents
|
||||
arch: "amd64"
|
||||
@@ -580,8 +580,8 @@ steps:
|
||||
- <<: *common
|
||||
<<: *docker
|
||||
label: ":python: Python runtime tests (goferfs)"
|
||||
command: make python3.10.2-runtime-tests RUNTIME_ARGS=--directfs=false
|
||||
parallelism: 10
|
||||
command: make python3.12.3-runtime-tests RUNTIME_ARGS=--directfs=false
|
||||
parallelism: 2
|
||||
if: build.branch == "master"
|
||||
agents:
|
||||
<<: *platform_specific_agents
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
FROM ubuntu:bionic
|
||||
FROM ubuntu:jammy
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
gcc \
|
||||
@@ -12,7 +12,7 @@ RUN apt-get update && apt-get install -y \
|
||||
|
||||
# Use flags -LJO to follow the html redirect and download .tar.gz.
|
||||
WORKDIR /root
|
||||
ARG VERSION=3.10.2
|
||||
ARG VERSION=3.12.3
|
||||
RUN curl -LJO https://github.com/python/cpython/archive/v${VERSION}.tar.gz
|
||||
RUN tar -zxf cpython-${VERSION}.tar.gz
|
||||
|
||||
+2
-2
@@ -36,8 +36,8 @@ runtime_test(
|
||||
)
|
||||
|
||||
runtime_test(
|
||||
name = "python3.10.2",
|
||||
exclude_file = "exclude/python3.10.2.csv",
|
||||
name = "python3.12.3",
|
||||
exclude_file = "exclude/python.csv",
|
||||
lang = "python",
|
||||
shard_count = more_shards,
|
||||
)
|
||||
|
||||
@@ -32,7 +32,7 @@ Go | 1.22 | `make go1.22-runtime-tests`
|
||||
Java | 21 | `make java21-runtime-tests`
|
||||
NodeJS | 16.13.2 | `make nodejs16.13.2-runtime-tests`
|
||||
Php | 8.3.7 | `make php8.3.7-runtime-tests`
|
||||
Python | 3.10.2 | `make python3.10.2-runtime-tests`
|
||||
Python | 3.12.3 | `make python3.12.3-runtime-tests`
|
||||
|
||||
You can modify the runtime test behaviors by passing in the following `make`
|
||||
variables:
|
||||
|
||||
@@ -43,19 +43,14 @@ var exclude = map[string][]string{
|
||||
"test_asyncio.test_base_events": []string{
|
||||
"BaseEventLoopWithSelectorTests.test_create_connection_service_name",
|
||||
},
|
||||
// TODO(b/271950879): Un-exclude once this bug is fixed.
|
||||
"test_asyncio.test_events": []string{
|
||||
"EPollEventLoopTests.test_bidirectional_pty",
|
||||
"PollEventLoopTests.test_bidirectional_pty",
|
||||
"SelectEventLoopTests.test_bidirectional_pty",
|
||||
},
|
||||
// TODO(b/162973328): Un-exclude once this bug is fixed.
|
||||
"test_asyncore": []string{
|
||||
"TestAPI_UseIPv4Poll.test_handle_expt",
|
||||
"TestAPI_UseIPv4Select.test_handle_expt",
|
||||
},
|
||||
// TODO(b/162978767): Un-exclude once this bug is fixed.
|
||||
"test_fcntl": []string{"TestFcntl.test_fcntl_64_bit"},
|
||||
// TODO(b/341776233): Un-exclude once this bug is fixed.
|
||||
"test_pathlib": []string{
|
||||
"PathSubclassTest.test_is_mount",
|
||||
"PathTest.test_is_mount",
|
||||
"PosixPathTest.test_is_mount",
|
||||
},
|
||||
// TODO(b/76174079): Un-exclude once this bug is fixed.
|
||||
"test_posix": []string{
|
||||
"PosixTester.test_sched_priority",
|
||||
@@ -64,14 +59,6 @@ var exclude = map[string][]string{
|
||||
"TestPosixSpawn.test_setscheduler_only_param",
|
||||
"TestPosixSpawnP.test_setscheduler_only_param",
|
||||
},
|
||||
// TODO(b/162979921): Un-exclude once this bug is fixed.
|
||||
"test_pty": []string{
|
||||
"PtyTest.test_fork",
|
||||
"PtyTest.test_master_read",
|
||||
"PtyTest.test_spawn_doesnt_hang",
|
||||
},
|
||||
// TODO(b/162980389): Un-exclude once this bug is fixed.
|
||||
"test_readline": []string{"TestReadline.*"},
|
||||
// TODO(b/76174079): Un-exclude once this bug is fixed.
|
||||
"test_resource": []string{"ResourceTest.test_prlimit"},
|
||||
// TODO(b/271949964): Un-exclude test cases as they are fixed.
|
||||
@@ -79,8 +66,8 @@ var exclude = map[string][]string{
|
||||
"BasicUDPLITETest.testRecvFrom",
|
||||
"BasicUDPLITETest.testRecvFromNegative",
|
||||
"BasicUDPLITETest.testSendtoAndRecv",
|
||||
"GeneralModuleTests.testGetServBy",
|
||||
"GeneralModuleTests.testGetaddrinfo",
|
||||
"GeneralModuleTests.testGetServBy", // Broken test.
|
||||
"GeneralModuleTests.testGetaddrinfo", // Broken test.
|
||||
"RecvmsgIntoUDPLITETest.testRecvmsg",
|
||||
"RecvmsgIntoUDPLITETest.testRecvmsgAfterClose",
|
||||
"RecvmsgIntoUDPLITETest.testRecvmsgExplicitDefaults",
|
||||
@@ -120,16 +107,15 @@ var exclude = map[string][]string{
|
||||
"UDPLITETimeoutTest.testTimeoutZero",
|
||||
"UDPLITETimeoutTest.testUDPLITETimeout",
|
||||
},
|
||||
// TODO(b/274167897): Un-exclude test cases once this is patched upstream.
|
||||
// The test is broken: https://github.com/python/cpython/issues/102795
|
||||
"test_epoll": []string{"TestEPoll.test_control_and_wait"},
|
||||
}
|
||||
|
||||
// Some python test libraries contain other test libraries that have test cases
|
||||
// that need to be excluded. We need to expand such libraries so that the test
|
||||
// case exclusion can work correctly.
|
||||
var expand = []string{
|
||||
"test_asyncio",
|
||||
// TODO(b/341780803): Un-exclude once this bug is fixed.
|
||||
"test_termios": []string{
|
||||
"TestFunctions.test_tcdrain",
|
||||
"TestFunctions.test_tcflow",
|
||||
"TestFunctions.test_tcflush",
|
||||
"TestFunctions.test_tcsendbreak",
|
||||
"TestFunctions.test_tcflow_errors",
|
||||
"TestFunctions.test_tcflush_errors",
|
||||
},
|
||||
}
|
||||
|
||||
// pythonRunner implements TestRunner for Python.
|
||||
@@ -146,60 +132,20 @@ func (pythonRunner) ListTests() ([]string, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to list: %v", err)
|
||||
}
|
||||
testLibs := make(map[string]struct{})
|
||||
var res []string
|
||||
for _, testLib := range strings.Split(string(out), "\n") {
|
||||
if len(testLib) == 0 {
|
||||
continue
|
||||
}
|
||||
testLibs[testLib] = struct{}{}
|
||||
}
|
||||
for _, libToExpand := range expand {
|
||||
if _, ok := testLibs[libToExpand]; !ok {
|
||||
return nil, fmt.Errorf("%s test library was not listed", libToExpand)
|
||||
}
|
||||
delete(testLibs, libToExpand)
|
||||
subLibs, err := subTestLibs(libToExpand)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for subLib := range subLibs {
|
||||
testLibs[fmt.Sprintf("%s.%s", libToExpand, subLib)] = struct{}{}
|
||||
}
|
||||
}
|
||||
res := make([]string, 0, len(testLibs))
|
||||
for lib := range testLibs {
|
||||
res = append(res, lib)
|
||||
// Some test libraries (like "test_asyncio") have sub-libraries which are
|
||||
// expanded in the output with a "test." prefix. Remove it.
|
||||
res = append(res, strings.TrimPrefix(testLib, "test."))
|
||||
}
|
||||
// Sort to have deterministic results across shards.
|
||||
sort.Strings(res)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func subTestLibs(testLib string) (map[string]struct{}, error) {
|
||||
// --list-{tests/cases} is only implemented by the 'test' library.
|
||||
// Running './python -m test {X} --list-tests' does not list libraries inside
|
||||
// X library. We need to list all test cases and extract sub libraries.
|
||||
args := []string{"-m", "test", testLib, "--list-cases"}
|
||||
cmd := exec.Command("./python", args...)
|
||||
cmd.Stderr = os.Stderr
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to list: %v", err)
|
||||
}
|
||||
subLibs := make(map[string]struct{})
|
||||
for _, tc := range strings.Split(string(out), "\n") {
|
||||
if len(tc) == 0 {
|
||||
continue
|
||||
}
|
||||
idx := strings.Index(tc, testLib)
|
||||
if idx < 0 {
|
||||
return nil, fmt.Errorf("could not find %q library in test case %q", testLib, tc)
|
||||
}
|
||||
subLibs[strings.Split(tc[idx:], ".")[1]] = struct{}{}
|
||||
}
|
||||
return subLibs, nil
|
||||
}
|
||||
|
||||
// TestCmds implements TestRunner.TestCmds.
|
||||
func (pythonRunner) TestCmds(tests []string) []*exec.Cmd {
|
||||
var cmds []*exec.Cmd
|
||||
|
||||
Reference in New Issue
Block a user