Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace file locking logic with subdirectory #285

Closed
wants to merge 2 commits into from
Closed
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ glob = "0.3"
serde = "1.0.194"
serde_derive = "1.0.194"
serde_json = "1.0.110"
tempfile = "3.12.0"
termcolor = "1.0.4"
toml = "0.8"

Expand Down
18 changes: 0 additions & 18 deletions src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,6 @@ pub(crate) fn build_dependencies(project: &mut Project) -> Result<()> {
}

pub(crate) fn build_test(project: &Project, name: &Name) -> Result<Output> {
let _ = cargo(project)
.arg("clean")
.arg("--package")
.arg(&project.name)
.arg("--color=never")
.stdout(Stdio::null())
.stderr(Stdio::null())
.status();

cargo(project)
.arg(if project.has_pass { "build" } else { "check" })
.args(target())
Expand All @@ -122,15 +113,6 @@ pub(crate) fn build_test(project: &Project, name: &Name) -> Result<Output> {
}

pub(crate) fn build_all_tests(project: &Project) -> Result<Output> {
let _ = cargo(project)
.arg("clean")
.arg("--package")
.arg(&project.name)
.arg("--color=never")
.stdout(Stdio::null())
.stderr(Stdio::null())
.status();

cargo(project)
.arg(if project.has_pass { "build" } else { "check" })
.args(target())
Expand Down
137 changes: 0 additions & 137 deletions src/flock.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ mod env;
mod error;
mod expand;
mod features;
mod flock;
mod inherit;
mod manifest;
mod message;
Expand Down
12 changes: 5 additions & 7 deletions src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::directory::Directory;
use crate::env::Update;
use crate::error::{Error, Result};
use crate::expand::{expand_globs, ExpandedTest};
use crate::flock::Lock;
use crate::manifest::{Bin, Manifest, Name, Package, Workspace};
use crate::message::{self, Fail, Warn};
use crate::normalize::{self, Context, Variations};
Expand All @@ -17,10 +16,11 @@ use std::fs::{self, File};
use std::mem;
use std::path::{Path, PathBuf};
use std::str;
use tempfile::{tempdir, TempDir};

#[derive(Debug)]
pub(crate) struct Project {
pub dir: Directory,
pub dir: TempDir,
source_dir: Directory,
pub target_dir: Directory,
pub name: String,
Expand Down Expand Up @@ -50,11 +50,10 @@ impl Runner {
let mut tests = expand_globs(&self.tests);
filter(&mut tests);

let (project, _lock) = (|| {
let project = (|| {
let mut project = self.prepare(&tests)?;
let lock = Lock::acquire(path!(project.dir / ".lock"))?;
self.write(&mut project)?;
Ok((project, lock))
Ok(project)
})()
.unwrap_or_else(|err| {
message::prepare_fail(err);
Expand Down Expand Up @@ -147,9 +146,8 @@ impl Runner {
.collect();

let crate_name = &source_manifest.package.name;
let project_dir = path!(target_dir / "tests" / "trybuild" / crate_name /);
fs::create_dir_all(&project_dir)?;

let project_dir = tempdir()?;
let project_name = format!("{}-tests", crate_name);
let manifest = self.make_manifest(
&workspace,
Expand Down