deb: fix concurrent testing (by making them serial)
All checks were successful
CI / build (push) Successful in 8m34s
All checks were successful
CI / build (push) Successful in 8m34s
Co-authored-by: Valentin Haudiquet <valentin.haudiquet@canonical.com> Co-committed-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
This commit was merged in pull request #2.
This commit is contained in:
@@ -112,27 +112,41 @@ impl ContextDriver for UnshareDriver {
|
||||
}
|
||||
|
||||
fn create_temp_dir(&self) -> io::Result<String> {
|
||||
// Create a temporary directory inside the chroot
|
||||
let timestamp = std::time::SystemTime::now()
|
||||
// Create a temporary directory inside the chroot with unique naming
|
||||
let base_timestamp = std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_secs();
|
||||
|
||||
let work_dir_name = format!("pkh-build-{}", timestamp);
|
||||
let work_dir_inside_chroot = format!("/tmp/{}", work_dir_name);
|
||||
let mut attempt = 0;
|
||||
loop {
|
||||
let work_dir_name = if attempt == 0 {
|
||||
format!("pkh-build-{}", base_timestamp)
|
||||
} else {
|
||||
format!("pkh-build-{}-{}", base_timestamp, attempt)
|
||||
};
|
||||
|
||||
// Create the directory on the host filesystem
|
||||
let host_path = Path::new(&self.path).join("tmp").join(&work_dir_name);
|
||||
std::fs::create_dir_all(&host_path)?;
|
||||
let work_dir_inside_chroot = format!("/tmp/{}", work_dir_name);
|
||||
let host_path = Path::new(&self.path).join("tmp").join(&work_dir_name);
|
||||
|
||||
debug!(
|
||||
"Created work directory: {} (host: {})",
|
||||
work_dir_inside_chroot,
|
||||
host_path.display()
|
||||
);
|
||||
// Check if directory already exists
|
||||
if host_path.exists() {
|
||||
attempt += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Return the path as it appears inside the chroot
|
||||
Ok(work_dir_inside_chroot)
|
||||
// Create the directory on the host filesystem
|
||||
std::fs::create_dir_all(&host_path)?;
|
||||
|
||||
debug!(
|
||||
"Created work directory: {} (host: {})",
|
||||
work_dir_inside_chroot,
|
||||
host_path.display()
|
||||
);
|
||||
|
||||
// Return the path as it appears inside the chroot
|
||||
return Ok(work_dir_inside_chroot);
|
||||
}
|
||||
}
|
||||
|
||||
fn copy_path(&self, src: &Path, dest: &Path) -> io::Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user