diff options
-rw-r--r-- | README.md | 3 | ||||
-rwxr-xr-x | ci/build-check-sanitized.sh | 12 | ||||
-rwxr-xr-x | ci/installdeps.sh | 2 | ||||
-rw-r--r-- | tests/inst/src/destructive.rs | 2 | ||||
-rw-r--r-- | tests/inst/src/rpmostree.rs | 35 |
5 files changed, 45 insertions, 9 deletions
@@ -48,6 +48,9 @@ their [eos-updater](https://github.com/endlessm/eos-updater) and [deb-ostree-builder](https://github.com/dbnicholson/deb-ostree-builder) projects. +For Debian/apt, see also https://github.com/stb-tester/apt2ostree +and the LWN article [Merkle trees and build systems](https://lwn.net/Articles/821367/). + Fedora derivatives use rpm-ostree (noted below); there are 3 variants using OSTree: - [Fedora CoreOS](https://getfedora.org/en/coreos/) diff --git a/ci/build-check-sanitized.sh b/ci/build-check-sanitized.sh new file mode 100755 index 00000000..39c06f43 --- /dev/null +++ b/ci/build-check-sanitized.sh @@ -0,0 +1,12 @@ +#!/usr/bin/bash +# Build with ASAN and UBSAN + unit tests. + +set -xeuo pipefail + +dn=$(dirname $0) +. ${dn}/libbuild.sh +export CFLAGS='-fsanitize=address -fsanitize=undefined -fsanitize-undefined-trap-on-error' +# We leak global state in a few places, fixing that is hard. +export ASAN_OPTIONS='detect_leaks=0' +${dn}/build.sh +make check diff --git a/ci/installdeps.sh b/ci/installdeps.sh index 7d7c723e..6880d91d 100755 --- a/ci/installdeps.sh +++ b/ci/installdeps.sh @@ -7,7 +7,7 @@ set -xeuo pipefail # cosa buildroot container # https://github.com/coreos/coreos-assembler/pull/730 # And using `yum` at all means we can flake on fetching rpm metadata -if [ -n "${SKIP_INSTALLDEPS:-}" ]; then +if [ -n "${SKIP_INSTALLDEPS:-}" ] || test "$(id -u)" != 0; then exit 0 fi diff --git a/tests/inst/src/destructive.rs b/tests/inst/src/destructive.rs index d6977bff..42b42ebf 100644 --- a/tests/inst/src/destructive.rs +++ b/tests/inst/src/destructive.rs @@ -393,6 +393,8 @@ fn impl_transaction_test<M: AsRef<str>>( // then we'll exit implicitly via the reboot, and reenter the function // above. loop { + // Make sure previously failed services (if any) can run. + bash!("systemctl reset-failed || true")?; // Save the previous strategy as a string so we can use it in error // messages below let prev_strategy_str = format!("{:?}", live_strategy); diff --git a/tests/inst/src/rpmostree.rs b/tests/inst/src/rpmostree.rs index fee97355..b579c4e6 100644 --- a/tests/inst/src/rpmostree.rs +++ b/tests/inst/src/rpmostree.rs @@ -1,7 +1,6 @@ -use anyhow::Result; +use anyhow::{Context, Result}; use serde_derive::Deserialize; -use serde_json; -use std::process::{Command, Stdio}; +use std::process::Command; #[derive(Deserialize)] #[serde(rename_all = "kebab-case")] @@ -25,9 +24,29 @@ pub(crate) struct Deployment { } pub(crate) fn query_status() -> Result<Status> { - let cmd = Command::new("rpm-ostree") - .args(&["status", "--json"]) - .stdout(Stdio::piped()) - .spawn()?; - Ok(serde_json::from_reader(cmd.stdout.unwrap())?) + // Retry on temporary activation failures, see + // https://github.com/coreos/rpm-ostree/issues/2531 + let pause = std::time::Duration::from_secs(1); + let mut retries = 0; + let cmd_res = loop { + retries += 1; + let res = Command::new("rpm-ostree") + .args(&["status", "--json"]) + .output() + .context("failed to spawn 'rpm-ostree status'")?; + + if res.status.success() || retries >= 10 { + break res; + } + std::thread::sleep(pause); + }; + + if !cmd_res.status.success() { + anyhow::bail!( + "running 'rpm-ostree status' failed: {}", + String::from_utf8_lossy(&cmd_res.stderr) + ); + } + + serde_json::from_slice(&cmd_res.stdout).context("failed to parse 'rpm-ostree status' output") } |