2022-12-19 14:37:51 +00:00
|
|
|
definitions = '''
|
|
|
|
struct NodeA {
|
|
|
|
int x, y, z;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Structure that mimic the inside of a std::string
|
|
|
|
// So we can create bogus std::string and test TreeBuilder failures
|
|
|
|
struct StringInner {
|
|
|
|
uintptr_t buffer, size, capacity, extra;
|
|
|
|
};
|
|
|
|
'''
|
|
|
|
|
|
|
|
[cases]
|
|
|
|
[cases.a]
|
2023-08-16 20:40:36 +01:00
|
|
|
oil_disable = 'multi-argument probing has no meaning for oil'
|
2022-12-19 14:37:51 +00:00
|
|
|
param_types = ["int", "double"]
|
|
|
|
args = "arg0,arg1"
|
|
|
|
setup = "return {1,2.0};"
|
|
|
|
expect_json = '[{"staticSize":4, "dynamicSize":0},{"staticSize":8, "dynamicSize":0}]'
|
|
|
|
# TODO separate sizes for each argument?
|
|
|
|
|
|
|
|
# Test that TreeBuilder failing to run on the first arg doesn't impact the second arg
|
|
|
|
[cases.tb_fail_first_arg]
|
2022-12-21 14:43:56 +00:00
|
|
|
oil_disable = "treebuilder tests are oid specific"
|
2022-12-19 14:37:51 +00:00
|
|
|
param_types = ["const std::string&", "const NodeA&"]
|
|
|
|
args = "arg0,arg1"
|
|
|
|
setup = """
|
|
|
|
// Create a string with an invalid size/capacity to trip TreeBuilder
|
|
|
|
StringInner strIn{0, (uintptr_t)-1, (uintptr_t)-1, 0};
|
|
|
|
std::string *str = (std::string*)&strIn;
|
|
|
|
return { std::move(*str), NodeA{4, 5, 6} };
|
|
|
|
"""
|
|
|
|
expect_json = '[{},{"staticSize":12, "dynamicSize":0}]'
|
|
|
|
|
|
|
|
[cases.tb_all_fail_crashes]
|
2022-12-21 14:43:56 +00:00
|
|
|
oil_disable = "treebuilder tests are oid specific"
|
2022-12-19 14:37:51 +00:00
|
|
|
param_types = ["const std::string&", "const std::string&"]
|
|
|
|
args = "arg0,arg1"
|
|
|
|
setup = """
|
|
|
|
// Create a string with an invalid size/capacity to trip TreeBuilder
|
|
|
|
StringInner strIn1{0, (uintptr_t)-1, (uintptr_t)-1, 0};
|
|
|
|
std::string *str1 = (std::string*)&strIn1;
|
|
|
|
|
|
|
|
StringInner strIn2{0, (uintptr_t)-1, (uintptr_t)-1, 0};
|
|
|
|
std::string *str2 = (std::string*)&strIn2;
|
|
|
|
|
|
|
|
return { std::move(*str1), std::move(*str2) };
|
|
|
|
"""
|
|
|
|
expect_oid_exit_code = 6
|
|
|
|
expect_stderr = ".*Nothing to output: failed to run TreeBuilder on any argument.*"
|