Skip to content

Commit 067b633

Browse files
authored
Bumps deps and ubuntu version in vagrant (mdaffin#44)
* Bumps deps and ubuntu version in vagrant Fixes some issues caused by this: - we now get a warning about null pointer derefs caused by bindgen, these are now suppressed until an upstream fix is released - tests now run serially in the CI system and it is recommended to do the same locally with - tests now use /dev/loop3 as ubuntu 20.04 already uses 0-2 for snap - clang added to vagrant - remove verbose flags in travis - bumps minimum supported rust version to 1.50.0
1 parent 16e7567 commit 067b633

File tree

5 files changed

+29
-21
lines changed

5 files changed

+29
-21
lines changed

.travis.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ rust:
1111
- nightly
1212
- beta
1313
- stable
14-
- 1.45.0
15-
- 1.44.0
16-
- 1.43.0
14+
- 1.52.0
15+
- 1.51.0
16+
- 1.50.0
1717

1818
matrix:
1919
allow_failures:
@@ -30,8 +30,8 @@ env:
3030

3131
script:
3232
- '[[ "$TRAVIS_RUST_VERSION" != "stable" ]] || cargo clippy -- -D warnings'
33-
- cargo build --verbose
34-
- sudo -E env "PATH=$PATH" cargo test --verbose
33+
- cargo build
34+
- sudo -E env "PATH=$PATH" cargo test --jobs 1
3535

3636
deploy:
3737
- provider: script

Cargo.toml

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ travis-ci = { repository = "serde-rs/serde" }
1616
direct_io = []
1717

1818
[dependencies]
19-
errno = "0.2"
20-
libc = "0.2"
19+
errno = "0.2.8"
20+
libc = "0.2.105"
2121

2222
[build-dependencies]
23-
bindgen = { version = "0.58.1", default-features = false, features = ["runtime"] }
23+
bindgen = { version = "0.59.1", default-features = false, features = ["runtime"] }
2424

2525
[dev-dependencies]
26-
tempfile = "3.1.0"
27-
lazy_static = "1.3.0"
28-
serde_json = "1.0.40"
29-
serde = { version = "1.0.98", features = ["derive"] }
26+
tempfile = "3.2.0"
27+
lazy_static = "1.4.0"
28+
serde_json = "1.0.68"
29+
serde = { version = "1.0.130", features = ["derive"] }

Vagrantfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Vagrant.configure("2") do |config|
2-
config.vm.box = "ubuntu/bionic64"
2+
config.vm.box = "ubuntu/focal64"
33
config.vm.provision "shell",
44
inline: <<-EOS
55
curl https://sh.rustup.rs -sSf | sh -s -- -y
6-
apt install -y gcc
6+
apt update && apt install -y gcc clang
77
fallocate -l 128M /tmp/disk.img
88
mv /tmp/disk.img /vagrant/
99
EOS

src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Supress warnings generated by bindgen: https://github.com/rust-lang/rust-bindgen/issues/1651
2+
#![allow(deref_nullptr)]
3+
#![allow(unknown_lints)]
4+
15
//! Setup and control loop devices.
26
//!
37
//! Provides rust interface with similar functionality to the Linux utility `losetup`.

tests/integration_test.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use util::{attach_file, create_backing_file, detach_all, list_device, setup};
1414

1515
#[test]
1616
fn get_next_free_device() {
17+
let num_devices_at_start = list_device(None).len();
1718
let _lock = setup();
1819

1920
let lc = LoopControl::open().expect("should be able to open the LoopControl device");
@@ -23,7 +24,10 @@ fn get_next_free_device() {
2324

2425
assert_eq!(
2526
ld0.path(),
26-
Some(PathBuf::from("/dev/loop0")),
27+
Some(PathBuf::from(&format!(
28+
"/dev/loop{}",
29+
num_devices_at_start
30+
))),
2731
"should find the first loopback device"
2832
);
2933
}
@@ -68,7 +72,7 @@ fn attach_a_backing_file(offset: u64, sizelimit: u64, file_size: i64) {
6872

6973
let file = create_backing_file(file_size);
7074
let file_path = file.to_path_buf();
71-
let mut ld0 = lc
75+
let ld0 = lc
7276
.next_free()
7377
.expect("should not error finding the next free loopback device");
7478

@@ -146,18 +150,19 @@ fn detach_a_backing_file_with_sizelimit_overflow() {
146150
}
147151

148152
fn detach_a_backing_file(offset: u64, sizelimit: u64, file_size: i64) {
153+
let num_devices_at_start = list_device(None).len();
149154
let _lock = setup();
150155

151156
{
152157
let file = create_backing_file(file_size);
153158
attach_file(
154-
"/dev/loop0",
159+
"/dev/loop3",
155160
file.to_path_buf().to_str().unwrap(),
156161
offset,
157162
sizelimit,
158163
);
159164

160-
let ld0 = LoopDevice::open("/dev/loop0")
165+
let ld0 = LoopDevice::open("/dev/loop3")
161166
.expect("should be able to open the created loopback device");
162167

163168
ld0.detach()
@@ -167,11 +172,10 @@ fn detach_a_backing_file(offset: u64, sizelimit: u64, file_size: i64) {
167172
};
168173

169174
std::thread::sleep(std::time::Duration::from_millis(100));
170-
let devices = list_device(None);
171175

172176
assert_eq!(
173-
devices.len(),
174-
0,
177+
list_device(None).len(),
178+
num_devices_at_start,
175179
"there should be no loopback devices mounted"
176180
);
177181
detach_all();

0 commit comments

Comments
 (0)