Skip to content

Commit c5f8ba4

Browse files
committed
Merge branch 'main' into http-canary
2 parents 2fe9be5 + a301c3d commit c5f8ba4

756 files changed

Lines changed: 40010 additions & 81528 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
import Builder
3+
import os
4+
import argparse
5+
6+
7+
class AWSCrtJavaBuild(Builder.Action):
8+
9+
def run(self, env):
10+
if os.getenv("CRT_FIPS") is not None:
11+
env.shell.exec("mvn", "-Dmaven.wagon.http.retryHandler.class=standard", "-Dmaven.wagon.http.retryHandler.count=3", "-Dmaven.wagon.http.pool=false", "-P", "continuous-integration", "-B", "compile",
12+
"-Dcmake.crt_fips=ON", check=True)
13+
else:
14+
env.shell.exec("mvn", "-Dmaven.wagon.http.retryHandler.class=standard", "-Dmaven.wagon.http.retryHandler.count=3", "-Dmaven.wagon.http.pool=false", "-P", "continuous-integration",
15+
"-B", "compile", check=True)
16+
17+
parser = argparse.ArgumentParser()
18+
parser.add_argument('--classifier')
19+
args = parser.parse_known_args(env.args.args)[0]
20+
if args.classifier:
21+
env.shell.exec("mvn", "-B", "install", "-DskipTests", "-Dshared-lib.skip=true",
22+
"-Dmaven.wagon.http.retryHandler.class=standard","-Dmaven.wagon.http.retryHandler.count=3", "-Dmaven.wagon.http.pool=false",
23+
f"-Dcrt.classifier={args.classifier}", check=True)
Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,75 @@
1-
21
import Builder
32
import sys
43
import os
4+
import os.path
55

66

77
class AWSCrtJavaTest(Builder.Action):
88

9-
def run(self, env):
9+
def _run_java_tests(self, *extra_args):
10+
if os.path.exists('log.txt'):
11+
os.remove('log.txt')
12+
13+
profiles = 'continuous-integration'
14+
if os.getenv("AWS_GRAALVM_CI") is not None:
15+
profiles = 'graalvm-native'
16+
17+
cmd_args = [
18+
"mvn", "-B",
19+
"-P", profiles,
20+
"-DredirectTestOutputToFile=true",
21+
"-DreuseForks=false",
22+
"-Daws.crt.memory.tracing=2",
23+
"-Daws.crt.debugnative=true",
24+
"-Daws.crt.aws_trace_log_per_test",
25+
"-Daws.crt.ci=true"
26+
]
27+
cmd_args.extend(extra_args)
28+
cmd_args.append("test")
29+
30+
result = self.env.shell.exec(*cmd_args, check=False)
31+
if result.returncode:
32+
if os.path.exists('log.txt'):
33+
print("--- CRT logs from failing test ---")
34+
with open('log.txt', 'r') as log:
35+
print(log.read())
36+
print("----------------------------------")
37+
sys.exit(f"Tests failed")
38+
39+
def start_maven_tests(self, env):
1040
# tests must run with leak detection turned on
1141
env.shell.setenv('AWS_CRT_MEMORY_TRACING', '2')
12-
actions = []
1342

14-
all_test_result = os.system("mvn -P continuous-integration -B test -DredirectTestOutputToFile=true -DreuseForks=false \
15-
-DrerunFailingTestsCount=5 -Daws.crt.memory.tracing=2 -Daws.crt.debugnative=true")
43+
self._run_java_tests("-DrerunFailingTestsCount=5")
44+
45+
if os.getenv("AWS_GRAALVM_CI") is None:
46+
# not running separate test for GraalVM, because GraalVM needs
47+
# rebuild to have separate test to run and rebuild will fail the MQTT tests.
48+
# because currently builder will pull the MQTT related cert/private to the
49+
# `cmake-build` directory and it will be removed after rebuild :)
50+
# also those tests mostly for JVM, which is not very meaning for GraalVM, skip them.
51+
52+
# run the ShutdownTest by itself
53+
env.shell.setenv('AWS_CRT_SHUTDOWN_TESTING', '1')
54+
self._run_java_tests("-Dtest=ShutdownTest")
1655

17-
env.shell.setenv('AWS_CRT_SHUTDOWN_TESTING', '1')
18-
shutdown_test_result = os.system("mvn -P continuous-integration -B test -DredirectTestOutputToFile=true -DreuseForks=false \
19-
-Daws.crt.memory.tracing=2 -Daws.crt.debugnative=true -Dtest=ShutdownTest")
56+
# run the InitTest by itself. This creates an environment where the test itself is the one that
57+
# causes the CRT to be loaded and initialized.
58+
self._run_java_tests("-Dtest=InitTest")
2059

21-
if shutdown_test_result or all_test_result:
22-
# Failed
23-
actions.append("exit 1")
24-
os.system("cat log.txt")
25-
python = sys.executable
26-
actions.append(
27-
[python, 'crt/aws-c-http/integration-testing/http_client_test.py',
28-
python, 'integration-testing/java_elasticurl_runner.py'])
60+
# postman-echo.com in now requires TLS1.3,
61+
# but our Mac implementation doesn't support TLS1.3 yet.
62+
# The work has been planned to Dec. 2025 to support TLS1.3,
63+
# so disable the test for now. And reenable it afterward
64+
# # run the elasticurl integration tests
65+
# python = sys.executable
66+
# env.shell.exec(python, 'crt/aws-c-http/integration-testing/http_client_test.py',
67+
# python, 'integration-testing/java_elasticurl_runner.py', check=True)
68+
69+
def run(self, env):
70+
self.env = env
2971

30-
return Builder.Script(actions, name='aws-crt-java-test')
72+
return Builder.Script([
73+
Builder.SetupCrossCICrtEnvironment(),
74+
self.start_maven_tests # Then run the Maven stuff
75+
])

.builder/actions/crt-ci-prep.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

.builder/actions/localhost_test.py

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,60 @@
11
import Builder
2+
import subprocess
3+
import socket
24
import sys
5+
import time
36
import os
4-
7+
import platform
58

69
class LocalhostTest(Builder.Action):
710

11+
def start(self, env):
12+
python = sys.executable
13+
venv_path = os.path.join(env.root_dir,'crt','aws-c-http','tests','mock_server', '.venv')
14+
15+
result = env.shell.exec(python, '-m', 'venv', venv_path)
16+
if result.returncode != 0:
17+
print("Could not start a virtual environment. The localhost integration tests will fail.", file=sys.stderr)
18+
return
19+
20+
# Platform-specific
21+
if platform.system() == 'Windows':
22+
python = os.path.join(venv_path, "Scripts", "python.exe")
23+
else:
24+
python = os.path.join(venv_path, "bin", "python")
25+
26+
result = env.shell.exec(python, '-m', 'pip', 'install', 'h11', 'h2', 'trio')
27+
if result.returncode != 0:
28+
print("Could not install python HTTP dependencies. The localhost integration tests will fail.", file=sys.stderr)
29+
return
30+
31+
server_dir = os.path.join(env.root_dir,'crt','aws-c-http','tests','mock_server')
32+
33+
p1 = subprocess.Popen([python, "h2tls_mock_server.py"], cwd=server_dir)
34+
p2 = subprocess.Popen([python, "h2non_tls_server.py"], cwd=server_dir)
35+
p3 = subprocess.Popen([python, "h11mock_server.py"], cwd=server_dir)
36+
37+
# Wait for servers to be ready
38+
ports = [3443, 3280, 8082, 8081]
39+
for port in ports:
40+
for attempt in range(30):
41+
try:
42+
with socket.create_connection(("localhost", port), timeout=1):
43+
print(f"Server on port {port} is ready")
44+
break
45+
except (socket.error, ConnectionRefusedError, OSError):
46+
if attempt == 29:
47+
print(f"ERROR: Server on port {port} failed to start", file=sys.stderr)
48+
time.sleep(1)
49+
850
def run(self, env):
51+
self.start(env)
952
env.shell.setenv('AWS_CRT_MEMORY_TRACING', '2')
10-
actions = []
11-
if os.system("mvn -Dtest=Http2ClientLocalHostTest test -DredirectTestOutputToFile=true -DforkCount=0 \
53+
54+
if os.system("mvn test -DredirectTestOutputToFile=true -DforkCount=0 \
1255
-Daws.crt.memory.tracing=2 \
1356
-Daws.crt.debugnative=true \
14-
-Daws.crt.log.level=Debug \
57+
-Daws.crt.aws_trace_log_per_test \
1558
-Daws.crt.localhost=true"):
1659
# Failed
17-
actions.append("exit 1")
18-
19-
return Builder.Script(actions, name='aws-crt-java-test')
60+
sys.exit(1)

.builder/actions/pkcs11_test_setup.py

Lines changed: 0 additions & 169 deletions
This file was deleted.

0 commit comments

Comments
 (0)