Commit Graph

6484 Commits

Author SHA1 Message Date
andvar 82befdcba0 s/shold/should/ 2024-02-02 21:52:22 +00:00
rillig 183f84fe87 tests/lint: test lexing of characters and strings 2024-02-02 19:07:57 +00:00
rillig 8016349204 lint: fix debug output for strings, reduce code size
The debug output contained too many newlines.

The buffer functions were built into lint2 even though they weren't
used.

Enable the query for invisible characters in string literals, to make
sure that a newline in a string literal does not trigger that query.
2024-02-02 16:25:58 +00:00
rillig 402b4579b3 lint: make newline in a string literal an error in C90 and later 2024-02-02 16:05:37 +00:00
martin e9be82c8ac Skip the dtb set if the /boot partition is not mounted. 2024-01-30 16:57:32 +00:00
riastradh f17b3abd13 tests/usr.bin/mtree: Fixed the set lists, no more xfail.
PR misc/57877
2024-01-28 19:08:06 +00:00
rillig 7caac60117 tests/lint: enforce diagnostics to be listed in chronologic order
While here, fix the tests on uchar platforms.
2024-01-28 08:54:27 +00:00
rillig ea7127375b tests/lint: sort diagnostics in ilp32 tests chronologically 2024-01-28 08:26:07 +00:00
rillig d2c16d5796 tests/lint: sort multiple diagnostics per line chronologically
For now, the chronologic order is not enforced but has to be established
manually, for example by removing all 'expect' comment lines and
regenerating them with 'accept.sh -u'.

While here, clean up a few instances that came up when regenerating the
'expect' comments, such as wrong indentation or needless deviation from
the 'expect+1' form.
2024-01-28 08:17:27 +00:00
rillig 5357c932ab tests/lint: fix tests for integer constants on ILP32 platforms
The comment in msg_218 was both off-topic and wrong, so remove it.
2024-01-28 06:57:41 +00:00
rillig fc60683a64 tests/libutil/snprintb: remove redundant integer constant suffixes
I added these because lint told me so. Lint was wrong though, as it had
not implemented the C99 rules for integer constants.
2024-01-27 21:42:29 +00:00
rillig 8c7fbc585c lint: fix type of large integer constants 2024-01-27 20:03:14 +00:00
rillig a4d99aada1 tests/lint: test integer constants in different language levels 2024-01-27 15:10:56 +00:00
rillig 59290883cd tests/libutil/snprintb: fix test for 32-bit platforms 2024-01-27 10:32:03 +00:00
rillig c7aa2e0520 tests/libutil/snprintb: add more tests
Test all number bases (octal, decimal, hexadecimal), in both old-style
and new-style formats, as well as small buffer sizes.

Document working edge cases such as empty descriptions or descriptions
containing spaces, as well as situations that invoke undefined behavior.

Add comments to the individual test cases, as reading the actual format
strings takes more time.
2024-01-27 08:54:15 +00:00
riastradh e8c974429a tests/usr.bin/mtree: xfail PR 57877; omit needless debug print. 2024-01-26 00:32:46 +00:00
rillig efceecc2b3 tests/libutil/snprintb: clean up and extend tests
In case of a failure, print the details of the test case, including file
and line number of the actual test data. Do not write the format strings
directly to the output, as they contain non-printable bytes and embedded
null bytes.

After a failed test case, continue with the others.

Lay out the format strings according to their structure, to make them
more readable. Remove redundant "\0" at the end of the new-style format
strings.

Fix an off-by-one error in the test data: 0xf is FIFTEEN, not SIXTEEN.

Add a test for performing a restricted subset of rot13 in the format
string, to explore the limits of snprintb formatting.

What's still missing are tests for edge cases and error cases.
2024-01-25 18:13:14 +00:00
riastradh 00b317fce9 mtree(8): Test the installed sets.
Except etc and xetc, which likely won't match for reasons that aren't
great, like etc including empty log files which in an installed
system have probably changed.

This test will probably fail, but we should make sure it doesn't!

PR misc/57877
2024-01-25 00:30:57 +00:00
rillig 09702fc7eb lint: rename symt_t to symbol_kind
It was confusing to have two kinds of "symbol type" (s_type and s_symt),
so rename all related identifiers to be more distinctive.

No functional change.
2024-01-23 19:44:28 +00:00
christos 16b546eeb6 Add range tests with trailing characters. 2024-01-20 16:52:41 +00:00
rillig 45efdafbcc lint: add query for const automatic variables 2024-01-20 10:02:31 +00:00
rillig 6f23d4df44 lint: allow '\e' only in GCC mode 2024-01-19 19:23:34 +00:00
andvar b433853d68 s/rouding/rounding/ in test description. 2024-01-14 12:44:09 +00:00
rillig e1fc9df408 lint: warn about integer overflow when folding constant INT_MIN / -1 2024-01-11 20:25:04 +00:00
rillig 4b7b10e320 lint: allow complex offsetof(type, member-designator)
Both GCC 11 and Clang 8 accept member-designators that are not
identifiers but designator sequences, such as in 'offsetof(struct stat,
st_atim.tv_sec)', so make lint accept them as well.
2024-01-09 23:46:54 +00:00
rillig 059939593e tests/lint: fix overflow test for 32-bit platforms (since yesterday)
Plain integer constants without suffix are first tried to fit into
'int', then 'long', but not 'long long'.  This means that numbers larger
than 32 bits must be written with the LL suffix.
2024-01-08 17:11:32 +00:00
rillig cc3c7d5b6a tests/lint: test operators, integer overflow, conversions 2024-01-07 21:19:42 +00:00
rillig 74d7189882 lint: allow querying for invisible characters in literals and constants 2024-01-07 18:42:37 +00:00
rillig 7762dd1cfb lint: fix crash for invalid __func__ (since 2023-01-29) 2024-01-07 12:43:16 +00:00
rillig 08e0319cf4 lint: remove redundant parentheses, braces and comments
Rename the functions for folding constant expressions, to make the
comments redundant.
2024-01-06 15:05:24 +00:00
rillig 648e87c8ee tests/lint: add spaces to expected files, for better readability 2023-12-30 22:44:22 +00:00
rillig 588350fc12 tests/lint: sync comments in test for strict bool mode with reality 2023-12-30 17:09:42 +00:00
rillig dd2389327b lint: in strict bool mode, allow 'a & b' in controlling expressions
Previously, the expression 'a & b' was only treated as bool if 'a' had
enum type.  This didn't cover cases in which bit masks were implemented
using integer types instead of enum sets.
2023-12-30 15:37:27 +00:00
rillig 7252c1d112 tests/lint: test '&' for non-enum types in strict bool mode 2023-12-30 15:18:57 +00:00
martin 21ef827d2a PR 57803: fix typo in test title. 2023-12-30 13:09:24 +00:00
andvar 79548a514e s/synax/syntax/ in test description. 2023-12-28 20:04:10 +00:00
rillig b4747d0de9 tests/indent: don't create an unneeded file 2023-12-17 10:02:09 +00:00
mlelstv d233f49979 mmap() fails for size == 0 with EINVAL unless the mapping is anonymous. 2023-12-11 09:26:08 +00:00
rillig 35fd37d4b4 tests/libcurses: require 3 digits in octal character escapes
Previously, the string literal "\0" had been interpreted as "0", which
would have made the backslash redundant.  The tests don't use this form.
2023-12-10 18:04:55 +00:00
rillig 97817c96ae indent: be strict about options from profile files
Previously, the "option" 'xdi0' was treated the same as '-xdi0'.
2023-12-10 17:45:35 +00:00
rillig 08fd84594d tests/libcurses: constify 2023-12-10 15:51:13 +00:00
rillig 2209bb4284 tests/libcurses: fix typo in comment 2023-12-10 15:42:29 +00:00
rillig d7c2af39e9 tests/indent: fix name of test case 2023-12-10 15:39:25 +00:00
rillig 960c22026a lint: allow querying for 'static' followed by non-'static' declaration 2023-12-10 15:29:38 +00:00
rillig de4a7516ed lint: clean up comments
No functional change.
2023-12-10 14:59:47 +00:00
riastradh 29fd213712 t_setrlimit: Narrow the scope of stack-protector warning suppression. 2023-12-07 16:54:44 +00:00
rillig 0fde876303 tests/indent: test compound expressions 2023-12-03 14:26:10 +00:00
rillig 9cb5ea81fb tests/libcurses: sync documentation with reality
Unknown escape sequences in string literals trigger an error, since
testlang_conf.l 1.22 from 2021-02-25.

The '\b' is recognized since testlang_conf.l 1.26 from 2021-11-15.
2023-12-03 09:42:36 +00:00
rillig 8a47554360 tests/lint: add more test cases for nonportable character comparison 2023-12-02 23:54:49 +00:00
christos 20b493dddb remove dup copy. 2023-12-02 16:18:17 +00:00