aboutsummaryrefslogtreecommitdiff
path: root/test_cases
AgeCommit message (Collapse)Author
2024-03-08order: tweak order merging to prefer second sequenceGiuliano Procida
The order functionality is used in the presentation of diffs of sequences. If there is a source code change from ``` struct s { int x; }; ``` to ``` struct s { long y; }; ``` then STG will now present this as the removal of `x` followed by the addition of `y` (instead of the other way around). This is how `diff(1)` presents things. The change also affects how permutations of sequences are presented. With the change from ``` struct s { int x; long y; }; ``` to ``` struct s { long y; int x; }; ``` STG will now mention the change of offset of `y` before that of `x` (instead of the other way around). These examples seem to be in opposition, but the consistent behaviour is that STG now preserves the order of the second sequence and greedily emits elements from the first sequence that respect this (instead of the other way around). Insertions, removals and renamings are more common than reorderings. This change pragmatically favours a more familiar presentation order for the more common cases. PiperOrigin-RevId: 609069142 Change-Id: I0b81cc1d9b115584241976a23921a67e5ebf1a8d
2024-03-08test suite: all expected STG output files are now annotatedSid Nayyar
PiperOrigin-RevId: 608943654 Change-Id: I57a7066f4e2c7c37e37d33db484417023f875e15
2024-03-08naming: emit method type instead of mangled nameGiuliano Procida
The type is more useful and meaningful in the context of virtual methods than the mangled name. PiperOrigin-RevId: 608643576 Change-Id: I9fdd9eee4df9ff89eb702b045335c57689ae28b7
2024-02-09test cases: add template template parameter testGiuliano Procida
C++ admits template template parameters where each such parameter is kinded, i.e., the kinds of its parameters are known. This test exercises compiler DWARF generation. It is also a prerequisite for experimenting with `clang -gsimple-template-names`. PiperOrigin-RevId: 596925399 Change-Id: I114f3545bd13f098904277bbbcd1ec47158f5f6e
2024-02-09test cases: add template value parameter testGiuliano Procida
C++ admits many kinds of template value parameters, not all of which are well represented or represented at all in DWARF. There is also no standard naming for these parameters. This test exercises compiler DWARF generation. It is also a prerequisite for experimenting with `clang -gsimple-template-names`. PiperOrigin-RevId: 596925206 Change-Id: If3f7c0ce9043730b5629c0e159d28be2793da966
2023-12-13Test cases: add TLS test with -femulated-tlsAleksei Vetrov
Add TLS symbols tests compiled with TLS emulation. The result contains ELF symbols prefixed with `__emutls` but these symbols doesn't have type information. GCC's behaviour is baked into the compiler but Clang TLS emulation can be overridden with flag control. DWARF doesn't have `DW_AT_location` when TLS is emulated so we can't detect that it is TLS in DWARF processing. We will need special logic to do the matching. PiperOrigin-RevId: 590329618 Change-Id: Id30288a1b1de384b6a41f6235d2f3a3628c4a82c
2023-12-13test cases: add pointer-to-member as a function parameterGiuliano Procida
This is added due to the potential concern noted in https://sourceware.org/bugzilla/show_bug.cgi?id=30260#c4. Also remove an obsolete TODO. PiperOrigin-RevId: 589802789 Change-Id: Ia52b51cc26978078b5bc5cf6eaf6451a656e0e65
2023-12-13type roots: ignore typedefs that would have been filtered outGiuliano Procida
When file-based type definition filtering (`--files`) is active, any type not matching the filter will not be considered a type root (`--types`). Previous to this change, such `typedef`s were still considered type roots. `typedef`, as a C and C++ language feature, does not permit forward declaration and STG does not model `typedef`s without a definition. STG only considers named types with definitions as type roots. Logically, if a `typedef` would have lost its definition, it should not be considered a type root. PiperOrigin-RevId: 586994877 Change-Id: I69c9a4069b7dca2d1e348e6690566ca843f4aba6
2023-12-13test cases: add a combined filter and type roots caseGiuliano Procida
* the source filter should remove all type definitions (except for `typedef`s where this is currently impossible) * the symbol filter should remove all symbols (which are not interesting here) * type roots are requested (picking up all defined named types) PiperOrigin-RevId: 586697229 Change-Id: I5a25805f8acb3488b644e42a54b512230a0ac883
2023-12-13test cases: add a typedef to the test caseGiuliano Procida
STG does not model `typedef`s without a definition, but if it did, the definition here should be filtered out. We cannot drop the `typedef` altogether as that would leave dangling references. Faking a dummy definition would become problematic at the point of type deduplication, with all such `Typedef` nodes pointing to the same thing. PiperOrigin-RevId: 586696207 Change-Id: I966b92b6a3f637c3fe03ad3e6de4ed6e94ec6120
2023-12-13test cases: rename source_filter/composite_and_enum to source_filter/typesGiuliano Procida
This test case should cover all kinds of named types. PiperOrigin-RevId: 586695910 Change-Id: Iaf88ef4ea0146fefdf9c574d6e4cec505c851fa5
2023-12-13test_cases: Add an unversioned function symbol to versioned symbols testSid Nayyar
Note that the ELF reader does not yet understand symbol versions. PiperOrigin-RevId: 584624060 Change-Id: I1216d5500065b09db95afbeb93e0515cf0d03089
2023-11-20test cases: add mutant qualifier typedef array testGiuliano Procida
C qualified typedefs have surprising semantics and we expect the types in this test to be treated particularly badly. There is no expectation that compiler, `stg` or `stgdiff` output is particularly correct here. PiperOrigin-RevId: 583953560 Change-Id: I750a026a96fcea1f0b93cdbbc41a928cb601ec2b
2023-11-20test cases: preserve type definition in array/simple_array test caseGiuliano Procida
This test case no longer requires passing `-fstandalone-debug` to Clang. PiperOrigin-RevId: 583304518 Change-Id: I7344cbded530a0150a0b97c0c310cd93c7cb025d
2023-11-20test cases: simplify reference/type_and_type diff testGiuliano Procida
This test case no longer tests more than needed nor requires passing `-fstandalone-debug` to Clang. PiperOrigin-RevId: 583304332 Change-Id: I49e23a2bda2da57636a83a1c7cab31f16c03b1bd
2023-11-20test cases: simplify reference/type testsGiuliano Procida
These test cases no longer test more than needed nor require passing `-fstandalone-debug` to Clang. PiperOrigin-RevId: 583304173 Change-Id: I74e8ae1cff8fb1a43ef000aa1089e6de8321484e
2023-11-20test cases: simplify namespace/simple testsGiuliano Procida
These test cases were (and probably still are) doing to much. * remove the `help` structure that pulled in various other kinds of type * name the typed entities sequentially (and remove `decl` abbreviation) * remove diff-related bits from the info test PiperOrigin-RevId: 583303930 Change-Id: I3eb0f1979c04dd5de71df29c10c0b195fa6b12f8
2023-11-20test cases: add test cases reading BTF and writing STGGiuliano Procida
These are `stg --btf` tests. PiperOrigin-RevId: 582681335 Change-Id: Id3684b742bf63c826f5af85abec80adce4214952
2023-11-20test cases: adjust function/methods diff test to work with gcc -O2Giuliano Procida
This case is tweaked to avoid triggering a GCC bug where optimisation destroys some debug information. It suffices to ensure that all the functions compile to different code. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112372 PiperOrigin-RevId: 582619794 Change-Id: Iafe51250d6fdcb6bf60421194b5dbef9a83e3700
2023-11-20test cases: simplify function/methods diff testGiuliano Procida
The functions don't need to do anything with their parameters. PiperOrigin-RevId: 582619641 Change-Id: I265f6bf9d163ed2726c30e1344f3067f69b8c92d
2023-11-15test cases: adjust function/virtual_method info test to work with gcc -O2Giuliano Procida
This case is tweaked to avoid triggering a GCC bug where optimisation destroys some debug information. It suffices to ensure that all the functions compile to different code. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112372 PiperOrigin-RevId: 582018600 Change-Id: I1637699694ec06eda5d7941135400b214ddc25b1
2023-11-15test cases: change "par" to "parameter" in function/methods test caseGiuliano Procida
This was an unhelpful abbreviation. PiperOrigin-RevId: 582004572 Change-Id: I53dd779b2338bf32cbe475d4892a28e866b5c101
2023-11-15test cases: adjust types/char diff test to work with gcc -O2Giuliano Procida
This case is tweaked to avoid triggering a GCC bug where optimisation destroys some debug information. It suffices to ensure that all functions compile to different code. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112372 PiperOrigin-RevId: 582004246 Change-Id: Id514bcd03d13ba6eb43c030fffb537b7148cc4e8
2023-11-15test cases: adjust describe/types diff test to work with gcc -O2Giuliano Procida
This case is tweaked to avoid triggering a GCC bug where optimisation destroys some debug information. It suffices to ensure that all the functions compile to different code. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112372 This test case contains array of qualified element types, resulting in ambiguous representations in DWARF and STG. Internally, STG strips qualifiers from array types during comparison and just reports on the basis of qualifiers on the element types. GCC and Clang compilation currently result in different but equivalent ABI graphs. This will be resolved eventually, by removing array qualifiers from STG inputs. PiperOrigin-RevId: 582003940 Change-Id: I5030a7c2d630ec98820735905cee7d6c7105d7cc
2023-11-15test cases: adjust qualified/useless tests to work with gcc -O2Giuliano Procida
These cases are tweaked to avoid triggering a GCC bug where optimisation destroys some debug information. It suffices to ensure that all the functions compile to different code. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112372 STG output still varies between GCC and Clang compilation, due to indeterminate qualifier ordering. PiperOrigin-RevId: 582003501 Change-Id: I85c2408c25b63d209be7f9ba38a7fa89cee655ea
2023-11-15test cases: adjust function/virtual_vs_non_virtual diff test to work with ↵Giuliano Procida
gcc -O2 This case is tweaked to avoid triggering a GCC bug where optimisation destroys some debug information. It suffices to ensure that all the functions compile to different code. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112372 PiperOrigin-RevId: 582003173 Change-Id: If32ff92a836bd6c8b4289bd8a9b86551fd9041d1
2023-11-15test cases: adjust function/variadic_parameter tests to work with gcc -O2Giuliano Procida
These cases are tweaked to avoid triggering a GCC bug where optimisation destroys some debug information. It suffices to ensure that all the functions compile to different code. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112372 Add note to document that function types of the form `T(...)` are incorrectly represented by G++ due to a separate issue. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111788 PiperOrigin-RevId: 582002845 Change-Id: I50c397649ebf7ba733d13dee74f1dbbeb2b569fb
2023-11-15test cases: adjust function/parameters tests to work with gcc -O2Giuliano Procida
These cases are tweaked to avoid triggering a GCC bug where optimisation destroys some debug information. It suffices to ensure that all the functions compile to different code. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112372 PiperOrigin-RevId: 582002413 Change-Id: Ib5a1ba9f3d6e12c380e67a4b8d4968ee4dd7956b
2023-11-15test cases: adjust symbol/visibility tests to work with gcc -O2Giuliano Procida
These cases are tweaked to avoid triggering a GCC bug where optimisation destroys some debug information. It suffices to ensure that all the functions compile to different code. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112372 PiperOrigin-RevId: 582002042 Change-Id: I5f62199967b6bc4dfd8b7c2fea7d9c467961428d
2023-11-15test cases: adjust symbol/version_definition tests to work with gcc -O2Giuliano Procida
These cases are tweaked to avoid triggering a GCC bug where optimisation destroys some debug information. It suffices to ensure that all the functions compile to different code. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112372 PiperOrigin-RevId: 582001739 Change-Id: I0d0215d70507ebfaaa38777bc90a653b60b41609
2023-11-15test cases: adjust symbol/variable_function_removed_changed_added diff test ↵Giuliano Procida
to work with gcc -O2 This case is tweaked to avoid triggering a GCC bug where optimisation destroys some debug information. It suffices to ensure that all the functions compile to different code. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112372 PiperOrigin-RevId: 582001245 Change-Id: Ied24e9fe740ab55a1ac0bcc019971f9ec91b682f
2023-11-15test cases: adjust struct/nested tests to work with gcc -O2Giuliano Procida
These cases are tweaked to avoid triggering a GCC bug where optimisation destroys some debug information. It suffices to ensure that all the functions compile to different code. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112372 PiperOrigin-RevId: 582000838 Change-Id: I495f55f1937a3f116f4390cb3b3e6dc97ff4e2f1
2023-11-15proto: Sort ELF symbols by versioned name while printingSid Nayyar
Sort `ElfSymbol` nodes by name, version info presence, default version and version name in this order. Use node ID to disambiguate nodes in case versioned names are equivalent. PiperOrigin-RevId: 581234138 Change-Id: Ica50b134bcb300f86e31181097921375dfe6c6f0
2023-11-15proto: Sort methods by mangled name while printingSid Nayyar
Sort `Method` nodes by mangled name and then unique external node ID. PiperOrigin-RevId: 581229412 Change-Id: Idee11e5090304e41c3212c7875d69c1ceeeb0719
2023-11-15test cases: add abigail_reader tests converted from info_testsAleksei Vetrov
Create XML files from all "info" test cases to test abigail reader. XML files were generated using `abidw` (version `2.1.0`) on compiled source files from `info_tests`. For example, commands would look like: ``` clang-17 -std=c17 -g -fstandalone-debug --target=riscv64-linux-gnu \ -c simple_array.c -o simple_array.c.o abidw --no-architecture --no-corpus-path --type-id-style hash \ --no-comp-dir-path --no-show-locs simple_array.c.o \ > simple_array.c.raw_xml ``` STG expectation files were generated by running command like: `stg --abi simple_array.c.xml --output expected/simple_array_c.abi_stg` PiperOrigin-RevId: 580932823 Change-Id: I2fc00a76c164f61fa779750ed84975af0cfa298e
2023-11-06Publish STG's test suiteMatthias Maennich
The STG test suite consists of a plethora of individual test cases, mostly written while developing STG. This commit publishes both test inputs and expectation files. The corresponding build system files and automation to test them will be provided at a later time. The test are currently partitioned into `info_tests` and `diff_tests`. The info tests ensure we have good standalone coverage of `stg` by exercising the extraction of features of interest, such as specific kinds of types, from ABI inputs. This works as follows: 1. compilation of source (`.c` or `.cc`) to ELF object (`.o`) files containing DWARF debug information 2. extraction of STG type information using `stg` 3. verification that the outputs match the expectations as text The diff tests ensure we have good coverage of the comparison, type naming and diff reporting code in `stgdiff`, by checking ABI comparison behaviour when extracting and comparing ABI representations from pairs of various ABI inputs, namely: - ELF object files containing DWARF - generated as above - STG files - generated as above - ELF object files containing BTF - currently generated with `pahole -J` These input pairs are then subject to: 1. ABI comparison using `stgdiff` producing multiple output formats 2. verification that the outputs match the expectations as text Currently the Abigail and BTF readers are primarily exercised indirectly, via diff testing. This is likely to change. PiperOrigin-RevId: 579870386 Change-Id: Ic8fb1e694ec0abbf7c4f78205a56121e4dc36c69