summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2024-03-15 05:45:50 +0000
committerLars Wirzenius <liw@liw.fi>2024-03-15 05:45:50 +0000
commitd19841b087996784f1437a743a6916a443f4911b (patch)
tree93dff6e69da88b75b6b3bdb74a6eee22cef08280
parented1c8990707b451580e45aea0169b9a82fe739f2 (diff)
parentf29c6e680baefec5289d4fb75d7bf96118b62d84 (diff)
downloadobnam-benchmark-main.tar.gz
Merge branch 'fixes' into 'main'HEADmain
fixes See merge request obnam/obnam-benchmark!16
-rwxr-xr-xcheck20
-rwxr-xr-xdebian/rules4
-rw-r--r--obnam-benchmark.md16
-rw-r--r--obnam-benchmark.subplot14
-rw-r--r--src/builder.rs4
-rw-r--r--src/client.rs4
-rw-r--r--src/daemon.rs10
-rw-r--r--src/suite.rs3
-rw-r--r--src/summain.rs4
9 files changed, 38 insertions, 41 deletions
diff --git a/check b/check
index cc8ef6c..ea6f30d 100755
--- a/check
+++ b/check
@@ -2,12 +2,20 @@
set -euo pipefail
+offline=
+if [ "$#" -gt 0 ] && [ "$1" = "--offline" ]; then
+ offline=--offline
+ shift 1
+fi
+
cargo clippy -q --all-targets -- -D clippy::all
-cargo build --all-targets -q
-chronic cargo test -q
-subplot docgen obnam-benchmark.md -o obnam-benchmark.html
-subplot docgen obnam-benchmark.md -o obnam-benchmark.pdf
-subplot codegen obnam-benchmark.md -o test.py
-chronic python3 test.py --log test.log "$@"
+cargo build --all-targets -q $offline
+chronic cargo test -q $offline
+subplot docgen obnam-benchmark.subplot -o obnam-benchmark.html
+subplot codegen obnam-benchmark.subplot -o test.py
+if ! chronic python3 test.py --log test.log "$@"; then
+ cat test.log
+ exit 1
+fi
cargo fmt -- --check
echo A-OK
diff --git a/debian/rules b/debian/rules
index 29cabab..f27120f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,13 +1,13 @@
#!/usr/bin/make -f
%:
- dh $@ --buildsystem cargo
+ dh $@
override_dh_auto_build:
true
override_dh_auto_install:
- cargo install --path=. --root=debian/obnam-benchmark
+ cargo install --offline --path=. --root=debian/obnam-benchmark
find debian -name '.crates*' -delete
override_dh_auto_test:
diff --git a/obnam-benchmark.md b/obnam-benchmark.md
index 5fc3164..d68b695 100644
--- a/obnam-benchmark.md
+++ b/obnam-benchmark.md
@@ -1,19 +1,3 @@
----
-title: "`obnam-benchmark`---tool to run benchmarks"
-author: "The Obnam project"
-documentclass: report
-bindings:
-- subplot/benchmark.yaml
-- lib/files.yaml
-- lib/runcmd.yaml
-impls:
- python:
- - subplot/benchmark.py
- - lib/files.py
- - lib/runcmd.py
-...
-
-
# Introduction
Obnam is a backup program. It aims to have good performance. To
diff --git a/obnam-benchmark.subplot b/obnam-benchmark.subplot
new file mode 100644
index 0000000..b0da175
--- /dev/null
+++ b/obnam-benchmark.subplot
@@ -0,0 +1,14 @@
+title: "`obnam-benchmark`---tool to run benchmarks"
+authors:
+ - The Obnam project
+markdowns:
+ - obnam-benchmark.md
+bindings:
+- subplot/benchmark.yaml
+- lib/files.yaml
+- lib/runcmd.yaml
+impls:
+ python:
+ - subplot/benchmark.py
+ - lib/files.py
+ - lib/runcmd.py
diff --git a/src/builder.rs b/src/builder.rs
index ac414c7..f2aadf2 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -92,7 +92,7 @@ impl ObnamBuilder {
}
let v = String::from_utf8_lossy(&output.stdout);
- let v = v.strip_suffix('\n').or(Some(&v)).unwrap().to_string();
+ let v = v.strip_suffix('\n').unwrap_or(&v).to_string();
Ok(v)
}
@@ -140,7 +140,7 @@ fn git_create_branch(dir: &Path, branch: &str, commit: &str) -> Result<(), Obnam
fn git_resolve(dir: &Path, commit: &str) -> Result<String, ObnamBuilderError> {
run("git", &["rev-parse", commit], dir)
- .map(|s| s.strip_suffix('\n').or(Some("")).unwrap().to_string())
+ .map(|s| s.strip_suffix('\n').unwrap_or("").to_string())
.map_err(ObnamBuilderError::Git)
}
diff --git a/src/client.rs b/src/client.rs
index dd2a624..43a52ec 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -58,9 +58,7 @@ impl ObnamClient {
std::process::exit(1);
}
- Ok(String::from_utf8_lossy(&output.stdout)
- .to_owned()
- .to_string())
+ Ok(String::from_utf8_lossy(&output.stdout).to_string())
}
}
diff --git a/src/daemon.rs b/src/daemon.rs
index 8bf8adb..10c197c 100644
--- a/src/daemon.rs
+++ b/src/daemon.rs
@@ -84,7 +84,7 @@ impl DaemonManager {
info!("start daemon: {:?}", argv);
let pid = NamedTempFile::new()?;
let output = Command::new("daemonize")
- .args(&[
+ .args([
"-c",
"/",
"-e",
@@ -134,13 +134,9 @@ impl DaemonManager {
if !cmd.is_empty() {
cmd.push(' ');
}
- cmd.push_str(
- &String::from_utf8_lossy(arg.as_bytes())
- .to_owned()
- .to_string(),
- );
+ cmd.push_str(String::from_utf8_lossy(arg.as_bytes()).to_string().as_ref());
}
- let err = read(&stderr).map_err(DaemonError::Stderr)?;
+ let err = read(stderr).map_err(DaemonError::Stderr)?;
let err = String::from_utf8_lossy(&err).into_owned();
Err(DaemonError::Timeout(self.timeout.as_millis(), cmd, err))
}
diff --git a/src/suite.rs b/src/suite.rs
index 86c4c6d..aeeff80 100644
--- a/src/suite.rs
+++ b/src/suite.rs
@@ -250,8 +250,7 @@ impl Benchmark {
.client
.run(&["resolve", "latest"])?
.strip_suffix('\n')
- .or(Some(""))
- .unwrap()
+ .unwrap_or("")
.to_string();
debug!("backed up generation {}", gen_id);
self.gen_ids.insert(n, gen_id);
diff --git a/src/summain.rs b/src/summain.rs
index ce9cf0f..3c977f1 100644
--- a/src/summain.rs
+++ b/src/summain.rs
@@ -19,7 +19,5 @@ pub fn summain(root: &Path) -> Result<String, SummainError> {
std::process::exit(1);
}
- Ok(String::from_utf8_lossy(&output.stdout)
- .to_owned()
- .to_string())
+ Ok(String::from_utf8_lossy(&output.stdout).to_string())
}