Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,31 @@ jobs:

- name: Install System Dependencies
run: |
sudo add-apt-repository ppa:criu/ppa
sudo add-apt-repository -y ppa:criu/ppa
sudo apt-get update
sudo apt-get install -qqy protobuf-compiler libprotobuf-dev criu
sudo apt-get install -qqy protobuf-compiler libprotobuf-dev criu wget

- name: Install Podman
run: |
wget https://github.com/containers/podman/releases/download/v5.5.2/podman-remote-static-linux_amd64.tar.gz
tar -xvf podman-remote-static-linux_amd64.tar.gz
mv bin/podman-remote-static-linux_amd64 podman
sudo mv podman /usr/local/bin/
sudo chmod +x /usr/local/bin/podman

- name: Install crun
run: |
sudo rm -f /usr/bin/crun
wget https://github.com/containers/crun/releases/download/1.23.1/crun-1.23.1-linux-amd64
sudo install -m 0755 crun-1.23.1-linux-amd64 /usr/bin/crun


- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy

- name: Run tests
run: make test
Expand Down
18 changes: 18 additions & 0 deletions tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,21 @@ pub fn spawn_server(port: u16) -> Child {
.spawn()
.expect("Failed to spawn criu-coordinator server. Did you run `cargo build`?")
}

#[allow(dead_code)]
pub fn is_root() -> bool {
let output = Command::new("id")
.arg("-u")
.output()
.expect("Failed to run `id -u` to check for root user.");
String::from_utf8_lossy(&output.stdout).trim() == "0"
}

#[allow(dead_code)]
pub fn is_criu_installed() -> bool {
Command::new("criu")
.arg("--version")
.output()
.map(|out| out.status.success())
.unwrap_or(false)
}
Loading
Loading