From 01cd394af1f8c8e578d421bfc20d0ec9e2373761 Mon Sep 17 00:00:00 2001 From: Aria Beingessner Date: Sun, 30 Jun 2024 21:31:14 -0400 Subject: [PATCH] fix some wrong tests and add some new ones Note that C still doesn't implement align, but as of #39 we combinatoric repr(rust) vs repr(c) and include rustcall as a calling convention, so our coverage of rust <-> rust (in particular for codegen_backend users) is significantly improved. fixes #23 fixes #21 fixes #15 --- include/tests/normal/simple.kdl | 2 +- include/tests/procgen/struct/TwoAlignedU32s.procgen.kdl | 9 +++++++++ include/tests/procgen/struct/TwoAlignedU64s.procgen.kdl | 9 +++++++++ .../{OptI32Tagged.procgen.kdl => OptionI32.procgen.kdl} | 2 +- include/tests/procgen/tagged/OptionU128.procgen.kdl | 8 ++++++++ .../tests/procgen/union/MultiVariantUnion.procgen.kdl | 1 + 6 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 include/tests/procgen/struct/TwoAlignedU32s.procgen.kdl create mode 100644 include/tests/procgen/struct/TwoAlignedU64s.procgen.kdl rename include/tests/procgen/tagged/{OptI32Tagged.procgen.kdl => OptionI32.procgen.kdl} (72%) create mode 100644 include/tests/procgen/tagged/OptionU128.procgen.kdl diff --git a/include/tests/normal/simple.kdl b/include/tests/normal/simple.kdl index ec3ed7d..bcf470c 100644 --- a/include/tests/normal/simple.kdl +++ b/include/tests/normal/simple.kdl @@ -13,7 +13,7 @@ fn "print" { fn "scale" { inputs { _ "Point3"; factor "f32"; } - output { "Point3"; } + outputs { "Point3"; } } fn "add" { diff --git a/include/tests/procgen/struct/TwoAlignedU32s.procgen.kdl b/include/tests/procgen/struct/TwoAlignedU32s.procgen.kdl new file mode 100644 index 0000000..e64d061 --- /dev/null +++ b/include/tests/procgen/struct/TwoAlignedU32s.procgen.kdl @@ -0,0 +1,9 @@ +// This was a problem for rustc (I think u32 = ulong here?) +// +// https://github.com/rust-lang/rust/issues/80127 + +@align 16 +struct "TwoU32s" { + a "u32" + b "u32" +} \ No newline at end of file diff --git a/include/tests/procgen/struct/TwoAlignedU64s.procgen.kdl b/include/tests/procgen/struct/TwoAlignedU64s.procgen.kdl new file mode 100644 index 0000000..01ed6ba --- /dev/null +++ b/include/tests/procgen/struct/TwoAlignedU64s.procgen.kdl @@ -0,0 +1,9 @@ +// This was a problem for rustc on ppc64le +// +// https://github.com/rust-lang/rust/issues/122767 + +@align 16 +struct "TwoU64s" { + a "u64" + b "u64" +} \ No newline at end of file diff --git a/include/tests/procgen/tagged/OptI32Tagged.procgen.kdl b/include/tests/procgen/tagged/OptionI32.procgen.kdl similarity index 72% rename from include/tests/procgen/tagged/OptI32Tagged.procgen.kdl rename to include/tests/procgen/tagged/OptionI32.procgen.kdl index 2d1a56e..7f0a957 100644 --- a/include/tests/procgen/tagged/OptI32Tagged.procgen.kdl +++ b/include/tests/procgen/tagged/OptionI32.procgen.kdl @@ -1,6 +1,6 @@ // An option-like enum of i32 -tagged "OptI32Tagged" { +tagged "OptionI32" { Some { _ "i32"; } None } \ No newline at end of file diff --git a/include/tests/procgen/tagged/OptionU128.procgen.kdl b/include/tests/procgen/tagged/OptionU128.procgen.kdl new file mode 100644 index 0000000..248faa1 --- /dev/null +++ b/include/tests/procgen/tagged/OptionU128.procgen.kdl @@ -0,0 +1,8 @@ +// This type was a problem for cranelift +// +// https://github.com/rust-lang/rustc_codegen_cranelift/issues/1449 + +tagged "OptionU128" { + Some { _ "u128"; } + None +} \ No newline at end of file diff --git a/include/tests/procgen/union/MultiVariantUnion.procgen.kdl b/include/tests/procgen/union/MultiVariantUnion.procgen.kdl index 03c9f5c..ad4e001 100644 --- a/include/tests/procgen/union/MultiVariantUnion.procgen.kdl +++ b/include/tests/procgen/union/MultiVariantUnion.procgen.kdl @@ -1,6 +1,7 @@ union "MultiVariantUnion" { _ "u32" _ "i64" + _ "Point3" } struct "Point3" {