Merge pull request #2343 from cgwalters/cargo-workspace

build-sys: Add toplevel workspace Cargo.toml
This commit is contained in:
Colin Walters 2021-04-15 19:32:11 -04:00 committed by GitHub
commit e4d42be31f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 4 deletions

6
Cargo.toml Normal file
View File

@ -0,0 +1,6 @@
# Today, this repository only uses Rust for tests. This
# toplevel Cargo.toml helps tools like rust-analyzer understand
# that this project contains Rust code. We don't otherwise currently
# use `cargo` for any part of the core build.
[workspace]
members = ["tests/inst"]

View File

@ -431,8 +431,11 @@ if ENABLE_INSTALLED_TESTS_EXCLUSIVE
dist_installed_test_scripts = $(_installed_or_uninstalled_test_scripts) dist_installed_test_scripts = $(_installed_or_uninstalled_test_scripts)
installed_test_programs = $(_installed_or_uninstalled_test_programs) installed_test_programs = $(_installed_or_uninstalled_test_programs)
check-local: check-local:
echo "NOTE: Run the Rust installed tests (uninstalled) with ./tests/run-installed"
echo "NOTE: Exclusive installed tests are enabled; to run them, make install, then: gnome-desktop-testing-runner -p 0 libostree/" echo "NOTE: Exclusive installed tests are enabled; to run them, make install, then: gnome-desktop-testing-runner -p 0 libostree/"
else else
check-local:
echo "NOTE: Run the Rust installed tests (uninstalled) with ./tests/run-installed"
dist_test_scripts += $(_installed_or_uninstalled_test_scripts) dist_test_scripts += $(_installed_or_uninstalled_test_scripts)
test_programs += $(_installed_or_uninstalled_test_programs) test_programs += $(_installed_or_uninstalled_test_programs)
endif endif

View File

@ -46,6 +46,9 @@ GITIGNOREFILES = aclocal.m4 build-aux/ buildutil/*.m4 config.h.in gtk-doc.make
# Generated by coreos-assembler build-fast and kola # Generated by coreos-assembler build-fast and kola
GITIGNOREFILES += fastbuild-*.qcow2 _kola_temp/ GITIGNOREFILES += fastbuild-*.qcow2 _kola_temp/
# Rust stuff
GITIGNOREFILES += target/ Cargo.lock
SUBDIRS += . SUBDIRS += .
if ENABLE_GTK_DOC if ENABLE_GTK_DOC

View File

@ -1,2 +0,0 @@
target/
Cargo.lock

View File

@ -6,10 +6,14 @@ use ostree::prelude::*;
use crate::test::*; use crate::test::*;
fn skip_non_ostree_host() -> bool {
!std::path::Path::new("/run/ostree-booted").exists()
}
#[itest] #[itest]
fn test_sysroot_ro() -> Result<()> { fn test_sysroot_ro() -> Result<()> {
// TODO add a skipped identifier // TODO add a skipped identifier
if !std::path::Path::new("/run/ostree-booted").exists() { if skip_non_ostree_host() {
return Ok(()); return Ok(());
} }
let cancellable = Some(gio::Cancellable::new()); let cancellable = Some(gio::Cancellable::new());
@ -34,6 +38,9 @@ fn test_sysroot_ro() -> Result<()> {
#[itest] #[itest]
fn test_immutable_bit() -> Result<()> { fn test_immutable_bit() -> Result<()> {
if skip_non_ostree_host() {
return Ok(());
}
// https://bugzilla.redhat.com/show_bug.cgi?id=1867601 // https://bugzilla.redhat.com/show_bug.cgi?id=1867601
cmd_has_output(sh_inline::bash_command!("lsattr -d /").unwrap(), "-i-")?; cmd_has_output(sh_inline::bash_command!("lsattr -d /").unwrap(), "-i-")?;
Ok(()) Ok(())

View File

@ -12,6 +12,6 @@ all:
install: install:
install -D -m 0644 -t $(KOLA_TESTDIR) $(LIBSCRIPTS) install -D -m 0644 -t $(KOLA_TESTDIR) $(LIBSCRIPTS)
for x in $(TESTDIRS); do rsync -rlv ./$${x} $(KOLA_TESTDIR)/; done for x in $(TESTDIRS); do rsync -rlv ./$${x} $(KOLA_TESTDIR)/; done
install -D -m 0755 -t $(KOLA_TESTDIR)/nondestructive-rs ../inst/target/release/ostree-test install -D -m 0755 -t $(KOLA_TESTDIR)/nondestructive-rs ../../target/release/ostree-test
install -D -m 0644 destructive-stamp.ign $(KOLA_TESTDIR)/destructive-rs/config.ign install -D -m 0644 destructive-stamp.ign $(KOLA_TESTDIR)/destructive-rs/config.ign
./install-wrappers.sh destructive-list.txt $(KOLA_TESTDIR)/destructive-rs ./install-wrappers.sh destructive-list.txt $(KOLA_TESTDIR)/destructive-rs

6
tests/run-installed Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
# Run this script after e.g. `sudo make install` in a development container/host
# to run tests which operate on the installed binaries.
set -xeuo pipefail
dn=$(dirname $0)
(cd ${dn}/../tests/inst && cargo run --release)