Skip to content

Commit

Permalink
Use get_subsystem_mount_point with relative path
Browse files Browse the repository at this point in the history
  • Loading branch information
posutsai committed Oct 18, 2024
1 parent c7a1995 commit 2fd67fe
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/contest/contest/src/tests/cgroups/cpu/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ use std::fs;
use std::path::Path;

Check warning on line 2 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, gnu)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs

Check warning on line 2 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, gnu)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs

Check warning on line 2 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, musl)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs

Check warning on line 2 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, musl)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs

Check warning on line 2 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (aarch64, gnu)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs

Check warning on line 2 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (aarch64, gnu)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs

Check warning on line 2 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (aarch64, musl)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs

Check warning on line 2 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (aarch64, musl)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs
use std::string::ToString;

use super::{create_cpu_spec, create_empty_spec, create_spec};
use crate::utils::test_outside_container;
use crate::utils::test_utils::check_container_created;
use anyhow::Result;
use libcgroups::common;
use libcgroups::v1::{util, ControllerType};
use num_cpus;

Check warning on line 11 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, gnu)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs

Check warning on line 11 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, gnu)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs

Check warning on line 11 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, musl)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs

Check warning on line 11 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, musl)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs

Check warning on line 11 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (aarch64, gnu)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs

Check warning on line 11 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (aarch64, gnu)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs

Check warning on line 11 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (aarch64, musl)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs

Check warning on line 11 in tests/contest/contest/src/tests/cgroups/cpu/v1.rs

View workflow job for this annotation

GitHub Actions / check (aarch64, musl)

Diff in /home/runner/work/youki/youki/tests/contest/contest/src/tests/cgroups/cpu/v1.rs
use test_framework::{test_result, ConditionalTest, TestGroup, TestResult};

use super::{create_cpu_spec, create_empty_spec, create_spec};
use crate::utils::test_outside_container;
use crate::utils::test_utils::{check_container_created, CGROUP_ROOT};

const CPU_CGROUP_PREFIX: &str = "/sys/fs/cgroup/cpu,cpuacct";
const DEFAULT_REALTIME_PERIOD: u64 = 1000000;
const DEFAULT_REALTIME_RUNTIME: i64 = 950000;
Expand Down Expand Up @@ -224,12 +224,12 @@ fn test_cpu_cgroups() -> TestResult {

fn check_cgroup_subsystem(
cgroup_name: &str,
subsystem: &str,
subsystem: &ControllerType,
filename: &str,
expected: &dyn ToString,
) -> Result<()> {
let cgroup_path = Path::new(CGROUP_ROOT)
.join(subsystem)
let mount_point = util::get_subsystem_mount_point(subsystem)?;
let cgroup_path = mount_point
.join("runtime-test")
.join(cgroup_name)
.join(filename);
Expand Down Expand Up @@ -258,31 +258,31 @@ fn test_relative_cpus() -> TestResult {
let cgroup_name = "test_relative_cpus";
test_result!(check_cgroup_subsystem(
cgroup_name,
"cpu,cpuacct",
&ControllerType::CpuAcct,
"cpu.shares",
&case.shares().unwrap(),
));
test_result!(check_cgroup_subsystem(
cgroup_name,
"cpu,cpuacct",
&ControllerType::CpuAcct,
"cpu.cfs_period_us",
&case.period().unwrap(),
));
test_result!(check_cgroup_subsystem(
cgroup_name,
"cpu,cpuacct",
&ControllerType::CpuAcct,
"cpu.cfs_quota_us",
&case.quota().unwrap(),
));
test_result!(check_cgroup_subsystem(
cgroup_name,
"cpuset",
&ControllerType::CpuSet,
"cpuset.cpus",
&case.cpus().to_owned().unwrap(),
));
test_result!(check_cgroup_subsystem(
cgroup_name,
"cpuset",
&ControllerType::CpuSet,
"cpuset.mems",
&case.mems().to_owned().unwrap()
));
Expand Down

0 comments on commit 2fd67fe

Please sign in to comment.