Skip to content

Commit

Permalink
[TESTS] starting filecheck tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Cr0a3 committed Oct 27, 2024
1 parent 3ed51be commit ba92769
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/linux-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ jobs:
uses: actions/checkout@v4

- name: Install Rust toolchain
run: |
run:
rustup update --no-self-update stable

- name: Install filecheck
run:
pip install filecheck

- name: Build
run: cargo build --all

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/windows-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ jobs:
run:
rustup update --no-self-update stable

- name: Install filecheck
run:
pip install filecheck

- name: Build
run: cargo build --all

Expand Down
10 changes: 10 additions & 0 deletions tests/x64/ret.yl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# RUN:
cargo run -p ylc -- -in=%s -asm-clr | filecheck %s

# IN:
define i32 @test() {
entry:
; CHECK: mov eax, 5
; CHECK: ret
ret i32 5
}
40 changes: 11 additions & 29 deletions tools/ytest/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,38 +109,20 @@ fn main() {
.replace("%c", path2_str);
let args = unescaper::unescape(&args).unwrap();
let args = args.trim();
let mut args = args.split(" ").collect::<Vec<&str>>();

let program = args.get(0).expect("expected valid excutable name").to_string();

args.reverse();
args.pop();
args.reverse();


println!("{}: executing following commandline: '{}{}'", "Info".blue().bold(), program, {
let mut fmt = String::new();

for arg in &args {
fmt.push_str(&format!(" {}", arg));
}

fmt
let mut cmd = Command::new( if cfg!(target_os = "windows") {
"cmd"
} else {
"sh"
});
cmd.arg(if cfg!(target_os = "windows") {
"/C"
} else {
"-c"
});

let mut cmd = Command::new( program );

for arg in args {
if arg == "" {
break;
}

if arg == " " {
continue;
}

cmd.arg( arg );
}
cmd.arg(args);

let out = cmd.output().expect("failed to execute the process");
let stdout = out.stdout;
Expand Down Expand Up @@ -170,7 +152,7 @@ fn main() {
exit(-1);
}
}
} else if cli.opt("neg-exit") && code == (-1i32 as u32) && !parsed.ignore_fail {
} else {
println!("{}: the programm didn't exit sucessfull with code {}", "Error".red().bold(), exit_code);
exit(-1);
}
Expand Down

0 comments on commit ba92769

Please sign in to comment.