Commit Graph

5559 Commits

Author SHA1 Message Date
rillig a99ea20b58 tests/lint: demonstrate non-enum warning for enum type mismatch
Seen in usr.bin/make/job.c:2122.
2021-11-29 23:58:06 +00:00
rillig 92a8802e46 tests/indent: test variants of the 'return' statement 2021-11-28 16:31:39 +00:00
rillig d15bc7b966 tests/indent: migrate token_question to lsym_question and extend it 2021-11-28 16:20:13 +00:00
rillig 2c9e62c12f tests/indent: migrate test token_case_label to lsym_case_label 2021-11-28 16:05:59 +00:00
rillig 1284b73f20 tests/indent: migrate token_comma to lsym_comma
The section on initializer values is new.
2021-11-28 15:26:22 +00:00
rillig f8e8fcdaab tests/indent: move test for ':' to lsym_token.c 2021-11-28 14:49:28 +00:00
rillig af3ccc52b1 indent: treat L"string" as a single token
There is never whitespace between the 'L' and the string literal or the
character constant. There might be a backslash-newline between them, but
that case was not handled before either.

No functional change.
2021-11-28 14:29:03 +00:00
rillig 6f0dfe8cce tests/lint: update history of exporting unnamed objects 2021-11-28 10:11:15 +00:00
rillig 5ddf099d32 lint: do not export unnamed objects to the .ln file
Since these objects are unnamed, they cannot be referenced by other
files or even create name clashes.

Seen in usr.sbin/cpuctl/aarch64.c, reported by Christos.
2021-11-28 10:01:36 +00:00
rillig f15bc3aa0e tests/lint1: reproduce parse error for accidentally exported name
Seen in usr.sbin/cpuctl/aarch64.c line 118.

error: aarch64.ln:857:
    not alnum or _:  (for '118d-1.0d1200000000_tmpA16PcC')

The name 00000000_tmp was not supposed to be exported.
2021-11-28 09:47:18 +00:00
rillig 55a5a895de lint2: in case of parse errors, output the offending line
This provides more of a clue than a simple '(not alnum or _: )',
especially in the output of build.sh.

While here, change the format of the error message to the standard
'%s:%d'. Since these are internal errors, they are not supposed to occur
often, so no need to change error(1).
2021-11-28 09:16:46 +00:00
rillig 4ce95f631e tests/lint2: fix regular expressions containing backslash
In regular expressions, a backslash must be doubled. In this case, ATF
didn't complain because the single backslashes were used in the pattern
'\($2\)', where they produced '\(...\\)'. Omitting the backslash for the
closing parenthesis was apparently OK; other regex implementations
complain about this.
2021-11-28 09:10:36 +00:00
rillig 3657b5ef48 indent: fix out of bounds memory access (since 2021-11-25) 2021-11-27 20:33:39 +00:00
rillig e7374d5882 tests/indent: demonstrate strange formatting (since 2021-11-25) 2021-11-27 19:21:42 +00:00
rillig 9a2baf090b indent: rename dump functions to output
No functional change.
2021-11-27 18:37:17 +00:00
gson ab5267d5c7 Force failure of the nfs_renamerace_cycle, p2k_ffs_renamerace_cycle,
and puffs_renamerace_cycle test cases as they fail only randomly or
only on some systems.
2021-11-27 15:23:33 +00:00
gson 0d1c554f2b The wg_handshake_timeout test case was failing because it contained
atf_fail "failed to trigger PR kern/56252" without a corresponding
atf_expect_fail "PR kern/56252", which makes no sense.  Since the
test case does occasionally fail on real hardware, fix this by adding
the atf_expect_fail rather than by removing the atf_fail.
2021-11-26 20:02:35 +00:00
gson 6dc8853fd6 Delete trailing whitespace 2021-11-26 15:45:52 +00:00
rillig 65cc42c6d0 indent: remove code that fixes malformed preprocessor directives 2021-11-26 14:27:19 +00:00
rillig c680087d06 indent: make error message for missing command line arguments clearer 2021-11-25 21:48:23 +00:00
rillig 51ce682b28 tests/indent: use escape sequence for newline characters
No functional change.
2021-11-25 21:45:28 +00:00
rillig 5852ffadb7 tests/indent: test in-place formatting with parse errors
The file gets formatted until the end, despite the parse error. This may
destroy layout details of the code but usually preserves the overall
structure. Since all source code is supposed to be under version
control, this is not a problem.
2021-11-25 21:39:21 +00:00
rillig 5554de13ae indent: fix accidentally joined and broken comments (since 2019-04-04)
The fixed version is not perfect as it gets the indentation of the last
line of the first comment wrong, but at least indent doesn't generate
malformed output anymore.
2021-11-25 20:44:09 +00:00
rillig 3ad751bf18 tests/indent: demonstrate bugs in comment processing 2021-11-25 20:14:00 +00:00
rillig 7ccaa90a01 tests/indent: fix misleading typedef name 2021-11-25 20:02:06 +00:00
rillig da67cf2c19 tests/indent: rename ps.in_parameter_declaration in test as well 2021-11-25 19:56:03 +00:00
rillig a2cadd752a indent: improve heuristic for spaces around '*' in declarations 2021-11-25 18:36:30 +00:00
rillig f6009395a1 tests/indent: demonstrate more example for broken '*' in declarations
Since indent-2021.11.25.16.41.33.
2021-11-25 18:20:21 +00:00
rillig c196c08428 tests/indent: demonstrate 'sizeof(int) *expr' (since 2021-11-25)
Broken in indent-2021.11.25.16.41.33, while fixing the spacing around
'*' in declarations.
2021-11-25 18:10:23 +00:00
rillig db3af19824 indent: extract lex_asterisk_unary into separate function
No functional change.
2021-11-25 17:46:51 +00:00
rillig 83c7310d0e indent: fix heuristic for declaration/definition to post-1990 reality 2021-11-25 17:10:53 +00:00
rillig c5f096eda7 tests/indent: remove unnecessary option for testing '-pcs'
Before lexi.c 1.157 from 2021-11-25, the option '-npsl' had been
necessary to prevent a wrong line break, as indent wrongly interpreted
the function declaration as a function definition, just because the
first ')' in the declaration line was not immediately followed by a ','
or ';'.
2021-11-25 16:56:02 +00:00
rillig dbc9f6e14c indent: fix space after function name for option '-pcs' 2021-11-25 16:51:24 +00:00
rillig 475c6de3de indent: fix spacing for unknown type names in declarations 2021-11-25 16:41:33 +00:00
rillig be070d599e tests/indent: test '*' in function declarations 2021-11-25 16:05:07 +00:00
hannken 36c3dfccee Consistently use "drvctl -l qemufwcfg0" to check if
running under qemu in general.
2021-11-25 14:17:22 +00:00
rillig 031c482fd4 indent: fix formatting of a few declarations involving unknown types 2021-11-25 08:03:08 +00:00
rillig 3e0ac2cb8a tests/indent: demonstrate several real-life formatting bugs
Collected by indenting usr.bin/make with the default profile.

The heuristic for distinguishing between type names and other
identifiers is way too primitive, it seems to have stopped evolving
somewhere before function prototypes were standardized in C90, at least
it handles function prototypes poorly.

indent-2014.09.04.04.06.07 added seemingly random spaces to
declarations, which were fixed in indent-2019.04.04.15.27.35, which came
5 years later. The latter commit introduced many new bugs, but it also
fixed this one.

The wrongly indented struct member declaration for HashTable has been
there since at least indent-2000.10.11.14.46.04.

The wrongly indented initializer expression was added in
indent-2019.04.04.15.27.35 (see above).
2021-11-24 21:34:34 +00:00
thorpej f5f80c0753 Temporary hack to work around incorrect/missing unwind info for
the t_sig_backtrace test case on ARM when compiled with optimization.
2021-11-23 23:29:55 +00:00
christos 1aef28dab7 undef a couple more. 2021-11-22 15:09:16 +00:00
kre ccfbc41ccb PR bin/53550
/bin/sh's processing of here doc expansions has changed.   Now it happens
in the context of the parent shell, so side effects are visible there,
just like all other redirection expansions.

We need to stop testing that that doesn't happen, and instead test
that it does.   This is that change.

Add another test case which is testing exactly the example from the PR
(well, with a different exit status, 1 is too generic and could happen
by accident) to make sure we don't reintroduce that bug sometime.
2021-11-22 05:21:54 +00:00
kre d4ae1f8bcf More tests that were doing ... | atf_check ...
which allows the atf_check to fail without causing the test to fail
(unless this is the (very) last command in the test case, in which case it
will fail with what can be interpreted as an internal error)/

Check for this failing and explicitly atf_fail whwn it does.
2021-11-22 05:07:15 +00:00
kre 2efc6dabce Deal with a lot more pipes into atf_check missed last time. 2021-11-21 20:50:35 +00:00
rillig a24edb48c0 tests/indent: demonstrate wrong formatting of type names in declarations 2021-11-21 11:02:25 +00:00
hannken ae0245f0df Test kernel/kqueue/t_timer, subtests abstime, basic_timer and timer_units
often fail when run on QEMU because QEMU misses clock interrupts.

Always check timespec against expected "tv_sec" and use an "4 * tv_sec"
upper bound when run under QEMU.

Now becomes part of PR kern/43997 "Kernel timer discrepancies".
2021-11-21 09:35:39 +00:00
rillig f1e674693c tests/lint: fix negation in explanation for strict bool mode 2021-11-20 17:27:46 +00:00
rillig 95e11159ea tests/indent: clean up and extend tests 2021-11-20 16:54:17 +00:00
christos 88c7966bab Merge common code for the chdir cases (Piyush Sachdeva)
I also deduplicated some more code
2021-11-20 14:28:29 +00:00
rillig 7ff923e370 indent/tests: remove outdated comment
This task was resolved in the previous commit.
2021-11-20 13:14:34 +00:00
rillig 401b0ca773 indent/tests: make warning for empty lines more helpful 2021-11-20 13:07:57 +00:00