mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-09 21:24:14 +00:00
4975b6e9fa
Previously we tested different feature flags by using the `cli_options` field in the test `.toml`. This works for OID but doesn't work for JIT OIL and won't work for AoT OIL when those tests get added. This change adds a new higher level `features` field to the test `.toml` which adds the features to the config file as a prefix. This works with all methods of generation. Change the existing `cli_options` features to `features` except for where they're testing something specific. Enable tests that were previously disabled for OIL but only didn't work because of not being able to enable features. Change pointer tests that are currently broken for OIL from `oil_disable` to `oil_skip` - they can work, but codegen is broken for them at the minute. Test plan: - CI - `make test` is no worse
197 lines
6.0 KiB
TOML
197 lines
6.0 KiB
TOML
includes = ["vector"]
|
|
definitions = '''
|
|
class A {
|
|
public:
|
|
int int_a;
|
|
};
|
|
|
|
class B : public A {
|
|
public:
|
|
virtual ~B() = default;
|
|
virtual void myfunc() {}
|
|
std::vector<int> vec_b;
|
|
};
|
|
|
|
class C : public B {
|
|
public:
|
|
virtual ~C() = default;
|
|
virtual void myfunc() override {}
|
|
int int_c;
|
|
};
|
|
'''
|
|
[cases]
|
|
[cases.a_as_a]
|
|
oil_skip = "Polymorphic inheritance disabled in OIL"
|
|
features = ["polymorphic-inheritance"]
|
|
param_types = ["const A&"]
|
|
arg_types = ["A"]
|
|
setup = "return {};"
|
|
expect_json = '''[{
|
|
"typeName":"ns_inheritance_polymorphic_non_dynamic_base::A",
|
|
"staticSize":4,
|
|
"dynamicSize":0,
|
|
"members":[
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0}
|
|
]}]'''
|
|
[cases.a_no_polymorphic]
|
|
param_types = ["const A&"]
|
|
arg_types = ["A"]
|
|
setup = 'return {};'
|
|
expect_json = '''[{
|
|
"typeName":"ns_inheritance_polymorphic_non_dynamic_base::A",
|
|
"staticSize":4,
|
|
"dynamicSize":0,
|
|
"members":[
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0}
|
|
]}]'''
|
|
expect_json_v2 = '''[{
|
|
"typeNames":["ns_inheritance_polymorphic_non_dynamic_base::A"],
|
|
"staticSize":4,
|
|
"dynamicSize":0,
|
|
"members":[
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0}
|
|
]}]'''
|
|
|
|
[cases.b_as_a]
|
|
oil_skip = "Polymorphic inheritance disabled in OIL"
|
|
features = ["polymorphic-inheritance"]
|
|
param_types = ["const A&"]
|
|
arg_types = ["B"]
|
|
setup = '''
|
|
B b;
|
|
b.vec_b = {1,2,3};
|
|
return b;
|
|
'''
|
|
expect_json = '''[{
|
|
"typeName":"ns_inheritance_polymorphic_non_dynamic_base::A",
|
|
"staticSize":4,
|
|
"dynamicSize":0,
|
|
"members":[
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0}
|
|
]}]'''
|
|
[cases.b_as_b]
|
|
oil_skip = "Polymorphic inheritance disabled in OIL"
|
|
features = ["polymorphic-inheritance"]
|
|
param_types = ["const B&"]
|
|
arg_types = ["B"]
|
|
setup = '''
|
|
B b;
|
|
b.vec_b = {1,2,3};
|
|
return b;
|
|
'''
|
|
expect_json = '''[{
|
|
"typeName":"ns_inheritance_polymorphic_non_dynamic_base::B",
|
|
"staticSize":40,
|
|
"dynamicSize":12,
|
|
"members":[
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0},
|
|
{"staticSize":8, "dynamicSize":0},
|
|
{"name":"vec_b", "staticSize":24, "dynamicSize":12, "length":3, "capacity":3, "elementStaticSize":4}
|
|
]}]'''
|
|
[cases.b_no_polymorphic]
|
|
oil_skip = "vptr included in output when it should probably be hidden" # https://github.com/facebookexperimental/object-introspection/issues/291
|
|
param_types = ["const B&"]
|
|
arg_types = ["B"]
|
|
setup = '''
|
|
B b;
|
|
b.vec_b = {1,2,3};
|
|
return b;
|
|
'''
|
|
expect_json = '''[{
|
|
"typeName":"ns_inheritance_polymorphic_non_dynamic_base::B",
|
|
"staticSize":40,
|
|
"dynamicSize":12,
|
|
"members":[
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0},
|
|
{"staticSize":8, "dynamicSize":0},
|
|
{"name":"vec_b", "staticSize":24, "dynamicSize":12, "length":3, "capacity":3, "elementStaticSize":4}
|
|
]}]'''
|
|
|
|
[cases.c_as_a]
|
|
oil_skip = "Polymorphic inheritance disabled in OIL"
|
|
features = ["polymorphic-inheritance"]
|
|
param_types = ["const A&"]
|
|
arg_types = ["C"]
|
|
setup = '''
|
|
C c;
|
|
c.vec_b = {1,2,3};
|
|
return c;
|
|
'''
|
|
expect_json = '''[{
|
|
"typeName":"ns_inheritance_polymorphic_non_dynamic_base::A",
|
|
"staticSize":4,
|
|
"dynamicSize":0,
|
|
"members":[
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0}
|
|
]}]'''
|
|
[cases.c_as_b]
|
|
oil_skip = "Polymorphic inheritance disabled in OIL"
|
|
features = ["polymorphic-inheritance"]
|
|
param_types = ["const B&"]
|
|
arg_types = ["C"]
|
|
setup = '''
|
|
C c;
|
|
c.vec_b = {1,2,3};
|
|
return c;
|
|
'''
|
|
expect_json = '''[{
|
|
"typeName":"ns_inheritance_polymorphic_non_dynamic_base::C",
|
|
"staticSize":48,
|
|
"dynamicSize":12,
|
|
"members":[
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0},
|
|
{"staticSize":8, "dynamicSize":0},
|
|
{"name":"vec_b", "staticSize":24, "dynamicSize":12, "length":3, "capacity":3, "elementStaticSize":4},
|
|
{"name":"int_c", "staticSize":4, "dynamicSize":0}
|
|
]}]'''
|
|
[cases.c_as_c]
|
|
oil_skip = "Polymorphic inheritance disabled in OIL"
|
|
features = ["polymorphic-inheritance"]
|
|
param_types = ["const C&"]
|
|
arg_types = ["C"]
|
|
setup = '''
|
|
C c;
|
|
c.vec_b = {1,2,3};
|
|
return c;
|
|
'''
|
|
expect_json = '''[{
|
|
"typeName":"ns_inheritance_polymorphic_non_dynamic_base::C",
|
|
"staticSize":48,
|
|
"dynamicSize":12,
|
|
"members":[
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0},
|
|
{"staticSize":8, "dynamicSize":0},
|
|
{"name":"vec_b", "staticSize":24, "dynamicSize":12, "length":3, "capacity":3, "elementStaticSize":4},
|
|
{"name":"int_c", "staticSize":4, "dynamicSize":0}
|
|
]}]'''
|
|
[cases.c_no_polymorphic]
|
|
oil_skip = 'vptrs are included int he json output' # https://github.com/facebookexperimental/object-introspection/issues/291
|
|
param_types = ["const C&"]
|
|
arg_types = ["C"]
|
|
setup = '''
|
|
C c;
|
|
c.vec_b = {1,2,3};
|
|
return c;
|
|
'''
|
|
expect_json = '''[{
|
|
"typeName":"ns_inheritance_polymorphic_non_dynamic_base::C",
|
|
"staticSize":48,
|
|
"dynamicSize":12,
|
|
"members":[
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0},
|
|
{"staticSize":8, "dynamicSize":0},
|
|
{"name":"vec_b", "staticSize":24, "dynamicSize":12, "length":3, "capacity":3, "elementStaticSize":4},
|
|
{"name":"int_c", "staticSize":4, "dynamicSize":0}
|
|
]}]'''
|
|
expect_json_v2 = '''[{
|
|
"typeNames": ["ns_inheritance_polymorphic_non_dynamic_base::C"],
|
|
"staticSize": 48,
|
|
"exclusiveSize": 8,
|
|
"members": [
|
|
{"name":"int_a", "staticSize":4, "exclusiveSize":4},
|
|
{"staticSize":8, "exclusiveSize":8},
|
|
{"name":"vec_b", "staticSize":24, "exclusiveSize":24, "length":3, "capacity":3},
|
|
{"name":"int_c", "staticSize":4, "exclusiveSize":4}
|
|
]
|
|
}]'''
|