object-introspection/test/integration/pointers_function.toml
Jake Hillion 4975b6e9fa test: add features field to integration tests
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
2024-01-16 16:23:21 +00:00

97 lines
3.1 KiB
TOML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

includes = ["functional"]
definitions = '''
void myFunction(int x) {
(void)x;
}
// Put this function pointer inside a struct since the test framework doesn't
// support the syntax required for passing raw function pointers as arguments
struct FuncPtrStruct {
void (*p)(int);
};
'''
[cases]
[cases.raw]
skip = "function pointers are not handled correctly" # https://github.com/facebookexperimental/object-introspection/issues/22
param_types = ["const FuncPtrStruct&"]
setup = "return {{myFunction}};"
expect_json = '''[{
"staticSize": 8,
"dynamicSize": 0,
"members": [{
"typeName": "void (*)(int)",
"staticSize": 8,
"dynamicSize": 0,
"NOT": {"pointer": 0},
"NOT": "members"
}]
}]'''
[cases.raw_chase] # We should never chase function pointers
skip = "function pointers are not handled correctly" # https://github.com/facebookexperimental/object-introspection/issues/22
param_types = ["const FuncPtrStruct&"]
setup = "return {{myFunction}};"
features = ["chase-raw-pointers"]
expect_json = '''[{
"staticSize": 8,
"dynamicSize": 0,
"members": [{
"typeName": "void (*)(int)",
"staticSize": 8,
"dynamicSize": 0,
"NOT": {"pointer": 0},
"NOT": "members"
}]
}]'''
[cases.raw_null]
skip = "function pointers are not handled correctly" # https://github.com/facebookexperimental/object-introspection/issues/22
param_types = ["const FuncPtrStruct&"]
setup = "return {{nullptr}};"
expect_json = '''[{
"staticSize": 8,
"dynamicSize": 0,
"members": [{
"typeName": "void (*)(int)",
"staticSize": 8,
"dynamicSize": 0,
"pointer": 0,
"NOT": "members"
}]
}]'''
[cases.std_function]
skip = "function pointers are not handled correctly" # https://github.com/facebookexperimental/object-introspection/issues/22
param_types = ["std::function<void(int)> &"]
setup = "return myFunction;"
expect_json = '''[{
"typeName": "function<void (int)>",
"staticSize": 32,
"dynamicSize": 0,
"NOT": {"pointer": 0},
"NOT": "members"
}]'''
[cases.std_function_chase] # We should never chase function pointers
skip = "function pointers are not handled correctly" # https://github.com/facebookexperimental/object-introspection/issues/22
param_types = ["std::function<void(int)> &"]
setup = "return myFunction;"
features = ["chase-raw-pointers"]
expect_json = '''[{
"typeName": "function<void (int)>",
"staticSize": 32,
"dynamicSize": 0,
"NOT": {"pointer": 0},
"NOT": "members"
}]'''
[cases.std_function_null]
skip = "function pointers are not handled correctly" # https://github.com/facebookexperimental/object-introspection/issues/22
param_types = ["std::function<void(int)> &"]
setup = "return nullptr;"
expect_json = '''[{
"typeName": "function<void (int)>",
"staticSize": 32,
"dynamicSize": 0,
"pointer": 0,
"NOT": "members"
}]'''