Use larger stacks for some mono tests

This commit is contained in:
Ayaz Hafiz 2023-05-16 11:57:06 -05:00
parent c0e52f9e54
commit 4e690103b0
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 12 additions and 8 deletions

View file

@ -9,6 +9,7 @@ pub fn mono_test(args: TokenStream, item: TokenStream) -> TokenStream {
let mut no_check = false;
let mut allow_type_errors = false;
let mut mode = "exec".to_owned();
let mut large_stack = false;
for arg in syn::parse_macro_input!(args as syn::AttributeArgs) {
use syn::{Lit, Meta, MetaNameValue, NestedMeta};
if let NestedMeta::Meta(Meta::NameValue(MetaNameValue {
@ -26,6 +27,9 @@ pub fn mono_test(args: TokenStream, item: TokenStream) -> TokenStream {
if path.is_ident("allow_type_errors") {
allow_type_errors = true;
}
if path.is_ident("large_stack") {
large_stack = true;
}
}
}
@ -44,8 +48,11 @@ pub fn mono_test(args: TokenStream, item: TokenStream) -> TokenStream {
#[test]
#(#attributes)*
#visibility fn #name(#args) {
compiles_to_ir(#name_str, #body, &#mode, #allow_type_errors, #no_check);
if #large_stack {
with_larger_debug_stack(|| compiles_to_ir(#name_str, #body, &#mode, #allow_type_errors, #no_check));
} else {
compiles_to_ir(#name_str, #body, &#mode, #allow_type_errors, #no_check);
}
}
};
result.into()