From 0642fa8383c9250c0db20520e52cc8d1b9daca92 Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 20 Oct 2022 07:33:14 +0000 Subject: [PATCH] Provide a harness driving rust-openssl's regress tests rust-openssl is an integral part of the Rust ecosystem and more than a dozen ports, including lang/rust itself, depend on it. We need to ensure that it keeps working with LibreSSL. If the rust and rust-openssl-tests packages are installed, create a cargo workspace under obj/ that compiles and runs the rust-openssl regress tests much like what is done for the openssl-ruby tests. This expands our regress coverage: for instance, this would have caught the broken ASN.1 indefinite length encoding caused by asn1/tasn_enc.c r1.25. Positive feedback beck jsing semarie Testing and ok anton --- regress/lib/libssl/rust-openssl/Cargo.toml | 8 ++++ regress/lib/libssl/rust-openssl/Makefile | 48 ++++++++++++++++++++++ regress/lib/libssl/rust-openssl/config | 6 +++ 3 files changed, 62 insertions(+) create mode 100644 regress/lib/libssl/rust-openssl/Cargo.toml create mode 100644 regress/lib/libssl/rust-openssl/Makefile create mode 100644 regress/lib/libssl/rust-openssl/config diff --git a/regress/lib/libssl/rust-openssl/Cargo.toml b/regress/lib/libssl/rust-openssl/Cargo.toml new file mode 100644 index 00000000000..c33c3475a7e --- /dev/null +++ b/regress/lib/libssl/rust-openssl/Cargo.toml @@ -0,0 +1,8 @@ +[workspace] +members = [ + "openssl", + "openssl-errors", + "openssl-macros", + "openssl-sys", + "systest", +] diff --git a/regress/lib/libssl/rust-openssl/Makefile b/regress/lib/libssl/rust-openssl/Makefile new file mode 100644 index 00000000000..88e231ec08a --- /dev/null +++ b/regress/lib/libssl/rust-openssl/Makefile @@ -0,0 +1,48 @@ +# $OpenBSD: Makefile,v 1.1.1.1 2022/10/20 07:33:14 tb Exp $ + +RUST_OPENSSL_TESTS = /usr/local/share/rust-openssl-tests +CARGO = /usr/local/bin/cargo + +.if !exists(${RUST_OPENSSL_TESTS}) || !exists(${CARGO}) +regress: + @echo packages rust-openssl-tests and rust are required for this regress + @echo SKIPPED +.else + +REGRESS_TARGETS += rust-openssl-test + +WORKSPACE_LINKS = openssl openssl-errors openssl-macros openssl-sys systest + +_WORKSPACE_COOKIE = .workspace + +${_WORKSPACE_COOKIE}: +. if ${.CURDIR} != ${.OBJDIR} + cp ${.CURDIR}/Cargo.toml ${.OBJDIR}/ +. endif + mkdir -p .cargo + cp ${.CURDIR}/config .cargo/ + cd ${.OBJDIR} && ln -sf ${WORKSPACE_LINKS:S,^,${RUST_OPENSSL_TESTS}/,} . + touch $@ + +CLEANFILES += Cargo.lock + +. if ${.CURDIR} != ${.OBJDIR} +CLEANFILES += Cargo.toml +. endif + +rust-openssl-test: ${_WORKSPACE_COOKIE} + cd ${.OBJDIR} && cargo test --offline --color=never -- --color=never + +CLEANFILES += ${_WORKSPACE_COOKIE} ${WORKSPACE_LINKS} + +. if make(clean) || make(cleandir) +. if exists(.cargo) || exists(target) +.BEGIN: + rm -rf .cargo + rm -rf target +. endif +. endif + +.endif + +.include diff --git a/regress/lib/libssl/rust-openssl/config b/regress/lib/libssl/rust-openssl/config new file mode 100644 index 00000000000..a47474744d4 --- /dev/null +++ b/regress/lib/libssl/rust-openssl/config @@ -0,0 +1,6 @@ +[net] + offline = true +[source.modcargo] + directory = '/usr/local/share/rust-openssl-tests/modcargo-crates' +[source.crates-io] + replace-with = 'modcargo' -- 2.20.1