summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2023-07-09lint: remove redundant '#' after 'argument' in diagnosticsHEADtrunkrillig
2023-07-08clock_gettime(2): Fix CLOCK_PROCESS/THREAD_CPUTIME_ID.riastradh
Use same calculation as getrusage, not some ad-hoc arithmetic of internal scheduler parameters that are periodically rewound. PR kern/57512 XXX pullup-8 XXX pullup-9 XXX pullup-10
2023-07-08lint: warn about pointer casts between different kinds of typesrillig
Pointer casts from an integer type to a floating-point type and vice versa get a 'maybe troublesome' warning now. The previous assumption that all types of the same bit-size are convertible may have been valid from a technical point of view, but still such code should get more attention. The rules for struct and union types could be made more fine-grained later, if the need arises. To suppress this warning, it's always possible to cast to an intermediate 'void *'.
2023-07-08t_timerfd: Sprinkle slightly more diagnostics.riastradh
Might help us to see if we're off by just a little bit (maybe a tiny jitter between the hardclock timer and the monotonic clock), or if something is seriously amiss when the timerfd_block test fails sporadically.
2023-07-08lint: do not use portable type sizes in integer constraintsrillig
This reverts the change from tree.c 1.547 from 2023-07-03. Back then, I didn't know that the actual value from a type's 'portable size in bits' was not supposed to be used.
2023-07-08t_clock_gettime: Add test for PR kern/57512.riastradh
2023-07-08lint: warn about conversion from 128-bit to smaller integer typesrillig
2023-07-08tests/lint: demonstrate missing warning for converting int128_trillig
2023-07-08tests/lint: fix a few ilp32 testsrillig
2023-07-08tests/lint: automate accepting changed test resultsrillig
2023-07-08tests/lint: only overwrite .exp files if the output actually changesrillig
2023-07-07lint: warn about function definitions without header declarationrillig
The existing warning was only issued for function declarations, not for function definitions. The interesting change in the tests is in msg_351.c. Many other tests use non-static functions due to their syntactic brevity. In these tests, the warning is disabled individually, to allow new functions to be added without generating warning 351.
2023-07-07lint: only skip 'unused' warnings after errors, not other warningsrillig
Previously, in -w mode, any warning suppressed further 'unused' warnings, even though there was no need to do that. This can be seen in the test gcc_attribute_var.c, where only the last unused variable from a function was marked as unused, the others slipped through. Fixed by counting the errors and the warnings separately and only combining them if actually desired.
2023-07-07tests/lint: test all combinations of {func,obj}_{decl,def}rillig
For a non-static function definition that is not declared in a header, lint doesn't currently warn. The previous test didn't notice this.
2023-07-07tests/lint: merge duplicate tests for C11 _Atomicrillig
2023-07-06t_sig_backtrace: Flush stdout before writing to STDOUT_FILENO.riastradh
Avoids confusing ordering of output.
2023-07-06tests/lint: ensure consistent preprocessor filenames in testsrillig
The deviations often happen when copying or renaming tests.
2023-07-05tests/libexec/ld.elf_so: Fix helper library makefiles.riastradh
1. Consolidate logic into a single helper.mk to reduce duplication. 2. Set NO* variables, not MK* variables which are reserved for user. 3. Avoid eager X!= in favour of lazy ${X:sh}. 4. Mark _g.a set list entries obsolete. Never should've been built! PR misc/57462
2023-07-05t_posix_memalign: Simplify.riastradh
No functional change intended.
2023-07-05t_posix_memalign: Fix this to reflect restriction lifted in C17.riastradh
2023-07-05tests/lint: spell platform identifiers for 'long double' consistentlyrillig
The test file names don't have a hyphen, so the identifiers shouldn't have one either.
2023-07-05tests/lint: add platform-specific tests for troublesome pointer castsrillig
2023-07-04t_posix_memalign: Expand test cases and properties.riastradh
- Test cartesian product of a sampling of sizes and a sampling of alignments. - Verify all the edge cases I could find in posix_memalign and aligned_alloc, including failure modes. - Test an unreasonably large (but aligned) allocation size. - Use ATF_CHECK_* instead of ATF_REQUIRE_* so all failures will be reported, not just the first one. - While here, build with -fno-builtin-aligned_alloc and with -fno-builtin-posix_memalign to make sure the compiler doesn't try any shenanigans. XXX pullup-10
2023-07-03lint: consistently use portable type size in integer constraintsrillig
Since tree.c 1.546 from 2023-07-03, lint no longer warned about possible loss of accuracy when converting from 'long' to 'int' on an ILP32 platform that uses 'unsigned long' for size_t, when run in portable mode (-p), which is enabled by default in the NetBSD build. The integer constraints avoid false-positive warnings by looking at the actual values an expression can take. The function can_represent is guarded by a condition that uses the portable_size_in_bits, but then internally used the opposite size_in_bits, which led to inconsistent results. The warning looks confusing though, as on an ILP32 platform, 'int' and 'long' have the same size and representation, therefore there cannot be an actual loss of accuracy. The warning may need to be reworded to explicitly mention the portability mode, in which sizeof(int) is assumed to be 3 instead of 4, to catch possible loss of accuracy on other platforms.
2023-07-03tests/lint: move platform-specific query tests to separate filesrillig
This fixes the tests on 'unsigned char' platforms. Thanks martin@ for the notification.
2023-07-03tests/lint: clean up tests for C99 boolrillig
2023-07-03lint: fix C11 mode to not allow C23 features (since yesterday)rillig
2023-07-03lint: rename uppercase QUAD to LLONGrillig
No binary change.
2023-07-02tests/lint: add C23 testsrillig
2023-07-02lint: add initial support for C23rillig
Required by xsrc/external/mit/MesaLib.old, brw_eu_validate.c, which initializes a struct using empty braces: 'return (struct string){};'.
2023-07-02lint: allow empty statements in GCC statement expressionsrillig
2023-07-02tests/lint: demonstrate empty statement in GCC statement expressionrillig
Seen in external/mit/xorg/lib/dri.old.
2023-07-02lint: rename 'quad' to 'signed int' or 'unsigned int'rillig
No functional change.
2023-07-01tests/lint: rework tests for type namesrillig
2023-07-01lint: clean up typosrillig
2023-07-01lint: fix initialization of unnamed union memberrillig
2023-06-30tests/lint: test initializing an unnamed unionrillig
2023-06-30lint: clean up names related to declaration levelsrillig
The previous prefix 'DK_' (declaration level kind) had a conflict with the 'DK_' (designator kind) in init.c, so change the prefix to 'DLK_'. The new name for dinfo_t is decl_level, which is more expressive. No functional change.
2023-06-30lint: fix handling of unnamed struct/union membersrillig
The support for unnamed struct/union members that was added in decl.c 1.60 from 2015-10-13 was simple but wrong. It didn't cover initializers of these structures and computed wrong sizes for structures containing anonymous unions. At that time, the handling of initializers was broken as well, it was fixed 6 years later in init.c 1.229 from 2021-12-22. Real-life examples for code that lint couldn't handle are: * external/bsd/jemalloc/dist/src/jemalloc.c * external/mit/xorg/lib/dri.old/Makefile
2023-06-30lint: clean up handling of declarationsrillig
No functional change.
2023-06-30tests/lint: extend tests for sizeof and alignofrillig
2023-06-30lint: fix computation of bit-field widthrillig
When bit-fields in packed structs were added on 2009-10-02, lint assumed that they would only use 'signed int' or 'unsigned int' as storage unit, even though C99 also allows _Bool. The cleanup commit for decl.c 1.225 from 2021-08-28 accidentally changed the rounding mode for bit-field storage units from round-up to round-down.
2023-06-30lint: make alignof(incomplete enum) an errorrillig
2023-06-30tests/lint: add more tests for sizeof, offsetof, alignofrillig
2023-06-30lint: add query for assigning an integer 0 to a pointerrillig
2023-06-30tests/lint: extend test for sizeof and offsetofrillig
2023-06-30tests/lint: demonstrate bugs in anonymous struct/union handlingrillig
2023-06-28tests/lint: demonstrate wrong size calculation in anonymous unionrillig
2023-06-28tests/lint: do not overwrite expected files that only differ in spacesrillig
2023-06-28tests/lint: fix preprocessor line number validationrillig
When running the tests via ATF, the filename was an absolute filename, while the preprocessing line in the test file uses a relative filename. These two didn't match.