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
126 lines
3.4 KiB
TOML
126 lines
3.4 KiB
TOML
definitions = '''
|
|
struct Single {
|
|
int bitfield : 3;
|
|
};
|
|
|
|
struct WithinBytes {
|
|
char a : 3;
|
|
char b : 5;
|
|
char c : 7;
|
|
};
|
|
|
|
struct StraddleBytes {
|
|
char a : 7;
|
|
char b : 7;
|
|
char c : 2;
|
|
};
|
|
|
|
struct Mixed {
|
|
int a;
|
|
char b : 4;
|
|
short c : 12;
|
|
char d;
|
|
int e : 22;
|
|
};
|
|
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic ignored "-Wbitfield-width"
|
|
// The bitfield will max out at the size of its type. Extra bits act as padding.
|
|
struct MoreBitsThanType {
|
|
char a : 29;
|
|
};
|
|
#pragma clang diagnostic pop
|
|
|
|
// A zero-sized bitfield adds default padding between neighbouring bitfields
|
|
struct ZeroBits {
|
|
char b1 : 3;
|
|
char : 0;
|
|
char b2 : 2;
|
|
};
|
|
|
|
enum class MyEnum {
|
|
One,
|
|
Two,
|
|
Three,
|
|
};
|
|
|
|
struct Enum {
|
|
MyEnum e : 2;
|
|
MyEnum f : 4;
|
|
};
|
|
'''
|
|
# TODO The sizes do not take bitfields into account. They count each field as
|
|
# if they were regular primitives.
|
|
[cases]
|
|
[cases.single]
|
|
|
|
oil_skip = "not implemented"
|
|
param_types = ["Single&"]
|
|
setup = "return {};"
|
|
expect_json = '''[
|
|
{"staticSize":4, "dynamicSize":0, "exclusiveSize":0, "members":[
|
|
{"staticSize":4, "dynamicSize":0, "exclusiveSize":4}
|
|
]}]'''
|
|
[cases.within_bytes]
|
|
|
|
oil_skip = "not implemented"
|
|
param_types = ["WithinBytes&"]
|
|
setup = "return {};"
|
|
expect_json = '''[
|
|
{"staticSize":2, "dynamicSize":0, "exclusiveSize":0, "members":[
|
|
{"staticSize":1, "dynamicSize":0, "exclusiveSize":1},
|
|
{"staticSize":1, "dynamicSize":0, "exclusiveSize":1},
|
|
{"staticSize":1, "dynamicSize":0, "exclusiveSize":1}
|
|
]}]'''
|
|
[cases.straddle_bytes]
|
|
|
|
oil_skip = "not implemented"
|
|
param_types = ["StraddleBytes&"]
|
|
setup = "return {};"
|
|
expect_json = '''[
|
|
{"staticSize":3, "dynamicSize":0, "exclusiveSize":0, "members":[
|
|
{"staticSize":1, "dynamicSize":0, "exclusiveSize":1},
|
|
{"staticSize":1, "dynamicSize":0, "exclusiveSize":1},
|
|
{"staticSize":1, "dynamicSize":0, "exclusiveSize":1}
|
|
]}]'''
|
|
[cases.mixed]
|
|
|
|
oil_skip = "not implemented"
|
|
param_types = ["Mixed&"]
|
|
setup = "return {};"
|
|
expect_json = '''[
|
|
{"staticSize":12, "dynamicSize":0, "exclusiveSize":0, "members":[
|
|
{"staticSize":4, "dynamicSize":0, "exclusiveSize":4},
|
|
{"staticSize":1, "dynamicSize":0, "exclusiveSize":1},
|
|
{"staticSize":2, "dynamicSize":0, "exclusiveSize":2},
|
|
{"staticSize":1, "dynamicSize":0, "exclusiveSize":1},
|
|
{"staticSize":4, "dynamicSize":0, "exclusiveSize":4}
|
|
]}]'''
|
|
[cases.more_bits_than_type] # TODO member sizes are wrong
|
|
skip = "drgn errors out"
|
|
|
|
oil_skip = "not implemented"
|
|
param_types = ["MoreBitsThanType&"]
|
|
setup = "return {};"
|
|
expect_json = '"TODO"'
|
|
[cases.zero_bits]
|
|
|
|
oil_skip = "not implemented"
|
|
param_types = ["ZeroBits&"]
|
|
setup = "return {};"
|
|
expect_json = '''[
|
|
{"staticSize":2, "dynamicSize":0, "exclusiveSize":0, "members":[
|
|
{"staticSize":1, "dynamicSize":0, "exclusiveSize":1},
|
|
{"staticSize":1, "dynamicSize":0, "exclusiveSize":1}
|
|
]}]'''
|
|
[cases.enum]
|
|
|
|
oil_skip = "not implemented"
|
|
param_types = ["Enum&"]
|
|
setup = "return {};"
|
|
expect_json = '''[
|
|
{"staticSize":4, "dynamicSize":0, "exclusiveSize":0, "members":[
|
|
{"staticSize":4, "dynamicSize":0, "exclusiveSize":4},
|
|
{"staticSize":4, "dynamicSize":0, "exclusiveSize":4}
|
|
]}]'''
|