Skip to content

Commit

Permalink
rust/tests: Adjust for new ostree
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cgwalters committed Sep 19, 2023
1 parent 878d601 commit 5f08401
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
15 changes: 9 additions & 6 deletions rust-bindings/tests/sign/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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]
Expand Down
8 changes: 5 additions & 3 deletions tests/libtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 5f08401

Please sign in to comment.