mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-09-19 19:19:05 +01: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
120 lines
3.9 KiB
TOML
120 lines
3.9 KiB
TOML
definitions = '''
|
|
struct Foo10 {
|
|
int arr[10];
|
|
};
|
|
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic ignored "-Wzero-length-array"
|
|
struct Foo0 {
|
|
int arr[0];
|
|
};
|
|
|
|
using ZeroLengthIntArray = int[0];
|
|
#pragma clang diagnostic pop
|
|
|
|
struct MultiDim {
|
|
int arr[2][3];
|
|
};
|
|
'''
|
|
[cases]
|
|
[cases.member_int10]
|
|
param_types = ["const Foo10&"]
|
|
setup = "return {};"
|
|
expect_json = '''[{
|
|
"staticSize":40,
|
|
"dynamicSize":0,
|
|
"members":[{
|
|
"staticSize":40,
|
|
"dynamicSize":0,
|
|
"length":10,
|
|
"capacity":10,
|
|
"elementStaticSize":4
|
|
}]}]'''
|
|
expect_json_v2 = '''[{
|
|
"staticSize":40,
|
|
"exclusiveSize":0,
|
|
"size":40,
|
|
"members":[{
|
|
"staticSize":40,
|
|
"exclusiveSize":0,
|
|
"size":40,
|
|
"length":10,
|
|
"capacity":10
|
|
}]}]'''
|
|
[cases.member_int0]
|
|
param_types = ["const Foo0&"]
|
|
setup = "return {};"
|
|
expect_json = '''[{
|
|
"staticSize":0,
|
|
"dynamicSize":0,
|
|
"members":[{
|
|
"staticSize":0,
|
|
"dynamicSize":0
|
|
}]}]'''
|
|
expect_json_v2 = '''[{
|
|
"staticSize":0,
|
|
"exclusiveSize":0,
|
|
"size":0,
|
|
"members":[{
|
|
"staticSize":0,
|
|
"exclusiveSize":0,
|
|
"size":0
|
|
}]}]'''
|
|
[cases.multidim_legacy] # Test for legacy behaviour. Remove with OICodeGen
|
|
oil_disable = 'oil only runs on codegen v2'
|
|
cli_options = ["-Ftype-graph", "-Ftree-builder-v2"]
|
|
param_types = ["const MultiDim&"]
|
|
setup = "return {};"
|
|
expect_json = '''[{
|
|
"staticSize":24,
|
|
"dynamicSize":0,
|
|
"members":[{
|
|
"staticSize":24,
|
|
"dynamicSize":0,
|
|
"length":6,
|
|
"capacity":6,
|
|
"elementStaticSize":4
|
|
}]}]'''
|
|
[cases.multidim]
|
|
|
|
param_types = ["const MultiDim&"]
|
|
setup = "return {};"
|
|
expect_json = '''[
|
|
{"staticSize":24, "dynamicSize":0, "exclusiveSize":0, "members":[
|
|
{"staticSize":24, "dynamicSize":0, "exclusiveSize":0, "length":2, "capacity":2, "elementStaticSize":12, "members":[
|
|
{"staticSize":12, "dynamicSize":0, "exclusiveSize":12, "length":3, "capacity":3, "elementStaticSize":4},
|
|
{"staticSize":12, "dynamicSize":0, "exclusiveSize":12, "length":3, "capacity":3, "elementStaticSize":4}]
|
|
}]}]'''
|
|
expect_json_v2 = '''[
|
|
{"staticSize":24, "exclusiveSize":0, "size":24, "members":[
|
|
{"staticSize":24, "exclusiveSize":0, "size":24, "length":2, "capacity":2, "members":[
|
|
{"typeNames":["int32_t[3]"], "staticSize":12, "exclusiveSize":0, "size":12, "length":3, "capacity":3},
|
|
{"typeNames":["int32_t[3]"], "staticSize":12, "exclusiveSize":0, "size":12, "length":3, "capacity":3}]
|
|
}]}]'''
|
|
[cases.direct_int10]
|
|
skip = "Direct array arguments don't work"
|
|
param_types = ["int[10]"]
|
|
setup = "return {};"
|
|
expect_json = '[{"staticSize":40, "dynamicSize":0, "length":10, "capacity":10, "elementStaticSize":4}]'
|
|
[cases.direct_int0]
|
|
skip = "Direct array arguments don't work"
|
|
# WARNING: zero-length arrays are handled differently to non-empty arrays.
|
|
# They end up not being treated as containers. This should probably change
|
|
# in the future.
|
|
param_types = ["ZeroLengthIntArray"]
|
|
setup = "return {};"
|
|
expect_json = '[{"staticSize":0, "dynamicSize":0}]'
|
|
[cases.ref_int10]
|
|
skip = "CodeGen bug with array reference arguments"
|
|
param_types = ["const int(&)[10]"]
|
|
setup = "return {};"
|
|
expect_json = '[{"staticSize":40, "dynamicSize":0, "length":10, "capacity":10, "elementStaticSize":4}]'
|
|
[cases.ref_int0]
|
|
skip = "CodeGen bug with array reference arguments"
|
|
# WARNING: zero-length arrays are handled differently to non-empty arrays.
|
|
# They end up not being treated as containers. This should probably change
|
|
# in the future.
|
|
param_types = ["const ZeroLengthIntArray&"]
|
|
setup = "return {};"
|
|
expect_json = '[{"staticSize":0, "dynamicSize":0}]'
|