Skip to content

Commit

Permalink
Split off tests with \ in the filename and ignore them for cargo-package
Browse files Browse the repository at this point in the history
  • Loading branch information
nabijaczleweli authored and keszybz committed Oct 25, 2021
1 parent a83726c commit 3c0911a
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ license = "MIT"
description = "Systemd unit generator for zram swap devices."
homepage = "https://github.com/systemd/zram-generator"
edition = "2018"
exclude = ["tests/07a-mount-point-excl"]

[dependencies]
anyhow = "1.0.12"
Expand Down
4 changes: 0 additions & 4 deletions tests/07-mount-point/etc/systemd/zram-generator.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ options = discard,casefold
mount-point = /foo//bar/baz/
fs-type = ext4

[zram14]
mount-point = /.żupan-ci3pły
fs-type = ext4

[zram15]
mount-point = ///
fs-type = ext4
3 changes: 3 additions & 0 deletions tests/07a-mount-point-excl/etc/systemd/zram-generator.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[zram14]
mount-point = /.żupan-ci3pły
fs-type = ext4
1 change: 1 addition & 0 deletions tests/07a-mount-point-excl/proc/meminfo
File renamed without changes.
19 changes: 18 additions & 1 deletion tests/test_cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,24 @@ fn test_06_kernel_enabled() {
#[test]
fn test_07_mount_point() {
let devices = test_generation("tests/07-mount-point").unwrap();
assert_eq!(devices.len(), 5);
assert_eq!(devices.len(), 4);
test_07_devices(devices);
}

/// cargo-package refuses to pack files with `\`s in them,
/// so we split them off to be able to push to crates.io
#[test]
fn test_07a_mount_point_excl() {
if !Path::new("tests/07a-mount-point-excl").exists() {
return;
}

let devices = test_generation("tests/07a-mount-point-excl").unwrap();
assert_eq!(devices.len(), 1);
test_07_devices(devices);
}

fn test_07_devices(devices: Vec<config::Device>) {
for d in &devices {
assert!(!d.is_swap());
assert_eq!(d.host_memory_limit_mb, None);
Expand Down

0 comments on commit 3c0911a

Please sign in to comment.