LLVM unit tests: use pretty_assertions for line-by-line diff

This commit is contained in:
Joëlle van Essen 2025-02-06 11:49:10 +01:00
parent 454dc540f2
commit 91afea1ee4
No known key found for this signature in database
GPG key ID: 28D3B5CDD4B43882
3 changed files with 27 additions and 2 deletions

25
Cargo.lock generated
View file

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "aho-corasick"
@ -290,6 +290,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "diff"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
[[package]]
name = "dynasm"
version = "1.2.3"
@ -573,6 +579,16 @@ version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
[[package]]
name = "pretty_assertions"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d"
dependencies = [
"diff",
"yansi",
]
[[package]]
name = "prettyplease"
version = "0.2.25"
@ -643,6 +659,7 @@ dependencies = [
"hip_runtime-sys",
"llvm_zluda",
"paste",
"pretty_assertions",
"ptx_parser",
"quick-error",
"rustc-hash 2.0.0",
@ -1114,6 +1131,12 @@ dependencies = [
"serde_json",
]
[[package]]
name = "yansi"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"
[[package]]
name = "zluda"
version = "0.0.0"

View file

@ -24,3 +24,4 @@ comgr = { path = "../comgr" }
tempfile = "3"
paste = "1.0"
cuda-driver-sys = "0.3.0"
pretty_assertions = "1.4.1"

View file

@ -6,6 +6,7 @@ use std::fmt;
use std::fmt::{Debug, Display, Formatter};
use std::mem;
use std::{ptr, str};
use pretty_assertions;
macro_rules! test_ptx {
($fn_name:ident, $input:expr, $output:expr) => {
@ -242,7 +243,7 @@ fn test_llvm_assert<
let ast = ptx_parser::parse_module_checked(ptx_text).unwrap();
let llvm_ir = pass::to_llvm_module(ast).unwrap();
let actual_ll = llvm_ir.llvm_ir.print_as_asm();
assert_eq!(actual_ll, expected_ll);
pretty_assertions::assert_eq!(actual_ll, expected_ll);
Ok(())
}