mirror of
https://github.com/Noratrieb/cargo-minimize.git
synced 2026-01-14 16:35:01 +01:00
remove windows cfgs
This commit is contained in:
parent
0ed3e5188f
commit
b3f08e6760
3 changed files with 0 additions and 88 deletions
|
|
@ -2,14 +2,6 @@ use anyhow::{ensure, Result};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore = "FIXME: Make this not cursed."]
|
|
||||||
#[cfg(not(unix))]
|
|
||||||
fn full_tests() -> Result<()> {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
#[cfg(unix)]
|
|
||||||
fn full_tests() -> Result<()> {
|
fn full_tests() -> Result<()> {
|
||||||
let status = Command::new("cargo").arg("runtest").spawn()?.wait()?;
|
let status = Command::new("cargo").arg("runtest").spawn()?.wait()?;
|
||||||
ensure!(status.success(), "runtest failed");
|
ensure!(status.success(), "runtest failed");
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
#[cfg(not(unix))]
|
|
||||||
compile_error!("FIXME: This does not support windows yet. I am so sorry.");
|
|
||||||
|
|
||||||
fn main() -> anyhow::Result<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
testsuite::full_tests()
|
testsuite::full_tests()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,6 @@ use regex::Regex;
|
||||||
use std::collections::hash_map::RandomState;
|
use std::collections::hash_map::RandomState;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::fs::Permissions;
|
|
||||||
use std::io::BufWriter;
|
|
||||||
#[cfg(unix)]
|
|
||||||
use std::os::unix::prelude::PermissionsExt;
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::{
|
use std::{
|
||||||
|
|
@ -48,12 +44,6 @@ fn run_build(command: &mut Command) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(unix))]
|
|
||||||
pub fn full_tests() -> Result<()> {
|
|
||||||
todo!("FIXME: Make this not cursed.")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
pub fn full_tests() -> Result<()> {
|
pub fn full_tests() -> Result<()> {
|
||||||
run_build(Command::new("cargo").args([
|
run_build(Command::new("cargo").args([
|
||||||
"build",
|
"build",
|
||||||
|
|
@ -153,71 +143,6 @@ fn setup_dir(path: &Path) -> Result<(TempDir, PathBuf)> {
|
||||||
Ok((tempdir, proj_dir))
|
Ok((tempdir, proj_dir))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setup_scripts(start_roots: &[String], proj_dir: &Path) -> Result<()> {
|
|
||||||
// FIXME: Do this in a good way.
|
|
||||||
// What the fuck is this.
|
|
||||||
{
|
|
||||||
let file = fs::File::create(proj_dir.join("check.sh"))?;
|
|
||||||
|
|
||||||
let expected_roots = start_roots
|
|
||||||
.iter()
|
|
||||||
.map(|root| format!("'{}'", root))
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.join(", ");
|
|
||||||
|
|
||||||
write!(
|
|
||||||
BufWriter::new(&file),
|
|
||||||
r#"#!/usr/bin/env bash
|
|
||||||
if ! cargo check ; then
|
|
||||||
>&2 echo "Cargo check failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
OUT=$(grep -ro "~MINIMIZE-ROOT [a-zA-Z_\-]*" --no-filename src)
|
|
||||||
|
|
||||||
python3 -c "
|
|
||||||
# Get the data from bash by just substituting it in. It works!
|
|
||||||
out = '''$OUT'''
|
|
||||||
|
|
||||||
lines = out.split('\n')
|
|
||||||
|
|
||||||
found = set()
|
|
||||||
|
|
||||||
for line in lines:
|
|
||||||
name = line.removeprefix('~MINIMIZE-ROOT').strip()
|
|
||||||
found.add(name)
|
|
||||||
|
|
||||||
# Pass in the data _from Rust directly_. Beautiful.
|
|
||||||
expected_roots = {{{expected_roots}}}
|
|
||||||
|
|
||||||
for root in expected_roots:
|
|
||||||
if root in found:
|
|
||||||
print(f'Found {{root}} in output')
|
|
||||||
else:
|
|
||||||
print(f'Did not find {{root}} in output!')
|
|
||||||
exit(1)
|
|
||||||
"
|
|
||||||
"#
|
|
||||||
)?;
|
|
||||||
|
|
||||||
file.set_permissions(Permissions::from_mode(0o777))?;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
let file = fs::File::create(proj_dir.join("lint.sh"))?;
|
|
||||||
|
|
||||||
write!(
|
|
||||||
BufWriter::new(&file),
|
|
||||||
r#"#!/usr/bin/env bash
|
|
||||||
cargo check
|
|
||||||
"#
|
|
||||||
)?;
|
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
file.set_permissions(Permissions::from_mode(0o777))?;
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn build(path: &Path, regression_checker_path: &Path) -> Result<()> {
|
fn build(path: &Path, regression_checker_path: &Path) -> Result<()> {
|
||||||
let (_tempdir, proj_dir) = setup_dir(path).context("setting up tempdir")?;
|
let (_tempdir, proj_dir) = setup_dir(path).context("setting up tempdir")?;
|
||||||
let mut cargo_minimize_path = PathBuf::from("target/debug/cargo-minimize");
|
let mut cargo_minimize_path = PathBuf::from("target/debug/cargo-minimize");
|
||||||
|
|
@ -230,8 +155,6 @@ fn build(path: &Path, regression_checker_path: &Path) -> Result<()> {
|
||||||
|
|
||||||
let start_roots = get_roots(&proj_dir).context("getting initial MINIMIZE-ROOTs")?;
|
let start_roots = get_roots(&proj_dir).context("getting initial MINIMIZE-ROOTs")?;
|
||||||
|
|
||||||
setup_scripts(&start_roots, &proj_dir).context("setting up scripts")?;
|
|
||||||
|
|
||||||
let mut cmd = Command::new(cargo_minimize);
|
let mut cmd = Command::new(cargo_minimize);
|
||||||
cmd.current_dir(&proj_dir);
|
cmd.current_dir(&proj_dir);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue