Skip to content

Commit

Permalink
Apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
FAlbertDev committed Aug 4, 2023
1 parent 85f2add commit ba484ec
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 29 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ jobs:
uses: ./.github/actions/setup-build-agent
with:
target: static
cache-key: linux-clang-x86_64-static
cache-key: linux-gcc-x86_64-static

- name: Build Botan
run: ./configure.py --compiler-cache=ccache --build-targets=static,cli --without-documentation && make -j8
run: ./configure.py --compiler-cache=ccache --build-targets=static,cli --without-documentation && make -j$(nproc)

- name: Install Java and Maven
uses: actions/setup-java@v3
Expand All @@ -91,7 +91,11 @@ jobs:
run: mvn install -DskipTests -Dspotless.apply.skip

- name: Test Botan Server with TLS-Anvil
run: python3 ./src/scripts/ci/ci_tlsanvil_test.py --server-test ./botan ./tlsanvil/TLS-Testsuite/apps/TLS-Testsuite.jar
run: >
python3 ./src/scripts/ci/ci_tlsanvil_test.py
--botan-exe ./botan
--tlsanvil-jar ./tlsanvil/TLS-Testsuite/apps/TLS-Testsuite.jar
--test-target server
env:
DOCKER: 1 # TLS-Anvil specific to disable the loading bar

Expand Down
39 changes: 13 additions & 26 deletions src/scripts/ci/ci_tlsanvil_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def create_cert_and_key(botan_exe_path):
cert_path = os.path.join(Config.key_and_cert_storage_path, Config.tmp_cert_file_name)

with open(key_path, 'w', encoding='utf-8') as keyfile:
subprocess.run([botan_exe_path, "keygen", "--algo=RSA"], stdout=keyfile, check=True)
subprocess.run([botan_exe_path, "keygen", "--algo=RSA", "--params=2048"], stdout=keyfile, check=True)

with open(cert_path, 'w', encoding='utf-8') as certfile:
subprocess.run([botan_exe_path, "gen_self_signed", key_path, "localhost"], stdout=certfile, check=True)
Expand Down Expand Up @@ -77,37 +77,24 @@ def main(args=None):
args = sys.argv[1:]

parser = argparse.ArgumentParser()
parser.add_argument(
"--server-test",
action="store_true",
default=False,
help="Test the Botan TLS server",
)
parser.add_argument(
"--client-test",
action="store_true",
default=False,
help="Test the Botan TLS client",
)
parser.add_argument("botan-executable", help="botan executable file")
parser.add_argument("tlsanvil-jar-file", help="TLS-Anvil test suite jar file")
parser.add_argument("--botan-exe", help="Botan executable file", required=True)
parser.add_argument("--tlsanvil-jar", help="TLS-Anvil test suite jar file", required=True)
parser.add_argument("--test-target", help="The TLS side to test", choices=['client', 'server'], required=True)

args = vars(parser.parse_args(args))

if args["server_test"] == args["client_test"]:
raise ValueError("Either 'server-test' or 'client-test' must be set")
if not os.path.isfile(args["tlsanvil_jar"]):
raise FileNotFoundError(f"Unable to find '{args['tlsanvil_jar']}'")

if not os.path.isfile(args["tlsanvil-jar-file"]):
raise FileNotFoundError(f"Unable to find '{args['tlsanvil-jar-file']}'")
if not os.path.isfile(args["botan_exe"]):
raise FileNotFoundError(f"Unable to find '{args['botan_exe']}'")

if not os.path.isfile(args["botan-executable"]):
raise FileNotFoundError(f"Unable to find '{args['botan-executable']}'")

if args["server_test"]:
server_test(args["botan-executable"], args["tlsanvil-jar-file"])
else:
client_test(args["botan-executable"], args["tlsanvil-jar-file"])
if args["test_target"] == "server":
server_test(args["botan_exe"], args["tlsanvil_jar"])
elif args["test_target"] == "client":
client_test(args["botan_exe"], args["tlsanvil_jar"])

return 0

if __name__ == "__main__":
sys.exit(main())

0 comments on commit ba484ec

Please sign in to comment.