From 5f08401b98a514c5d2191b1925f13990f2b3b2a9 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 19 Sep 2023 15:25:36 -0400 Subject: [PATCH] rust/tests: Adjust for new ostree The rust tests do two things: - Parse the error output from the binary, which broke when the new ostree hit Fedora stable - Source the libtest.sh test suite, which broke when we dropped the trivial-httpd binary by default --- rust-bindings/tests/sign/mod.rs | 15 +++++++++------ tests/libtest.sh | 8 +++++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/rust-bindings/tests/sign/mod.rs b/rust-bindings/tests/sign/mod.rs index 745076cbaa..788dc7ec1c 100644 --- a/rust-bindings/tests/sign/mod.rs +++ b/rust-bindings/tests/sign/mod.rs @@ -43,14 +43,19 @@ echo $ED25519SECRET > ed25519.secret ); let s = Command::new("bash") .env("G_TEST_SRCDIR", pwd) + .env("OSTREE_HTTPD", "/disabled") .current_dir(path) .args(["-euo", "pipefail"]) .args(["-c", cmd.as_str()]) .stdout(std::process::Stdio::null()) - .stderr(std::process::Stdio::null()) - .status() + .stderr(std::process::Stdio::piped()) + .output() .unwrap(); - assert!(s.success()); + if !s.status.success() { + let mut stderr = std::io::stderr().lock(); + let _ = std::io::copy(&mut std::io::Cursor::new(&s.stderr), &mut stderr); + panic!("failed to source libtest: {:?}", s.status); + } let seckey = std::fs::read_to_string(path.join("ed25519.secret")).unwrap(); let seckey = seckey.to_variant(); @@ -74,9 +79,7 @@ echo $ED25519SECRET > ed25519.secret let badsigs = [b"".as_slice()].to_variant(); let e = signer.data_verify(payload, &badsigs).err().unwrap(); - assert!(e - .to_string() - .contains("Invalid signature length of 0 bytes")) + assert!(e.to_string().contains("Ill-formed input"), "{}", e) } #[test] diff --git a/tests/libtest.sh b/tests/libtest.sh index 9d871aa430..cfe3c672d6 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -180,9 +180,11 @@ if test -n "${OT_TESTS_VALGRIND:-}"; then CMD_PREFIX="env G_SLICE=always-malloc OSTREE_SUPPRESS_SYNCFS=1 valgrind -q --error-exitcode=1 --leak-check=full --num-callers=30 --suppressions=${test_srcdir}/glib.supp --suppressions=${test_srcdir}/ostree.supp" fi -OSTREE_HTTPD="${G_TEST_BUILDDIR}/ostree-trivial-httpd" -if ! [ -x "${OSTREE_HTTPD}" ]; then - fatal "Failed to find ${OSTREE_HTTPD}" +if test -z "${OSTREE_HTTPD:-}"; then + OSTREE_HTTPD="${test_builddir}/ostree-trivial-httpd" + if ! [ -x "${OSTREE_HTTPD}" ]; then + fatal "Failed to find ${OSTREE_HTTPD}" + fi fi files_are_hardlinked() {