Commit Graph

285333 Commits

Author SHA1 Message Date
pgoyette 0d15fa02aa Add KERNEL_DIR to /etc/release
"Sure, why not" from xtos!
2021-02-14 18:45:44 +00:00
rillig 52e5117b68 make: rename VarExprStatus to ExprStatus
It is only used in var.c so there is no need to use a prefix.
2021-02-14 18:21:31 +00:00
rillig 73654455e2 make: add test for indirect ':U' modifier
Unlike ':ts' and ':tW', the effects of ':U' are visible even after the
modifiers from the nested expression have been applied.  These subtle
details, like many others, are not documented in the manual page.
2021-02-14 17:47:33 +00:00
rillig b37a044ff1 make: revert part of previous commit
That code was not ready yet.
2021-02-14 17:27:25 +00:00
rillig 62b202434d make: update line numbers in expected test output
The documentation from the previous commit added a few lines.
2021-02-14 17:24:47 +00:00
rillig a6cd09f3da make: document since when indirect modifiers are supported 2021-02-14 17:22:37 +00:00
rillig 7d5825c040 make: add more tests for edge cases in evaluating variable expressions
As a preparation for refactoring the code around variable expressions,
there need to be a few tests for indirect variable modifiers since these
were not covered before.

Indirect modifiers may include ':ts' and ':tW', which change the
interpretation of the variable expression in small details.  The scope
of these changes is limited to the indirect modifier, any evaluations
outside this indirect modifier are unaffected.

The changes to the .exp file are mostly line number changes, plus a
demonstration of a newly found bug, where an expression is evaluated
successfully despite producing a parse error.
2021-02-14 16:12:46 +00:00
jakllsch ca39d05145 if_bnx.c: fix misleading indentation
suggested by rillig@
2021-02-14 14:05:03 +00:00
rillig 2606f6962c make: add functions for assigning the value of an expression
The plan is to have only the "current value" of the expression as a
member, not the "new value".  To do this consistently and get the memory
management right, there must be a single place (or two) where the value
of the expression is updated.

No functional change.
2021-02-14 13:53:28 +00:00
rillig 733483f46f make: rename ApplyModifiersState_Define to Expr_Define
The type name ApplyModifiersState was only intended as a working draft,
its name is too long and its scope a little too narrow.

Applying the modifiers is the main part of evaluating a variable
expression, and the scope of that type will be extended to parsing the
name of the expression as well.  This will hopefully reduce the number
of parameters, which is currently at 14.

No functional change.
2021-02-14 13:46:01 +00:00
rillig fe28e4c2f6 make: fix TMPDIR in unit-tests
Combining the assignment operator ':=' with the variable modifier ':U'
on the same variable does not work as intended.  At the point where the
':U' is evaluated, the variable is guaranteed to be defined because the
code in VarAssign_EvalSubst says so.
2021-02-14 13:24:45 +00:00
rillig 635f837c66 make: condense the code for parsing :S and :C modifiers
No functional change.
2021-02-14 12:35:27 +00:00
rillig 35c51735d0 make: rearrange some comments to make them easier to spot 2021-02-14 12:24:53 +00:00
rillig 3b4441442a make: document purpose of stepping back in the parser
In ApplyModifier_Assign there was no need to compute the delimiter from
st->startc since that has already be done at that point.
2021-02-14 12:16:13 +00:00
rillig c8f6aa36d9 make: add test for ::= modifier enclosed in parentheses 2021-02-14 12:14:37 +00:00
rillig f6084dc243 tests/libcurses: document the history about tab bugs in addch/addstr
Verified by installing all versions of libcurses from 2012 to 2021 and
running a simple test program on them:

	#include <stdio.h>
	#include <curses.h>

	int
	main(int argc, char **argv)
	{
		int xstr, ystr, xch, ych;

		initscr();

		addstr("\t");
		xstr = getcurx(stdscr);
		addstr("\n");
		ystr = getcury(stdscr);

		addch('\t');
		xch = getcurx(stdscr);
		addch('\n');
		ych = getcury(stdscr);

		endwin();

		fprintf(stderr, "%s\t%d,%d\t%d,%d\n",
		    argv[1], ystr, xstr, ych, xch);
	}

Some selected outputs:

	...
	2016.11.24.14.49.08	1,0	2,8
	2016.11.28.18.25.26     1,8	2,8
	...
	2019.05.12.02.29.00	1,8	2,8
	2019.05.20.22.17.41	1,8	2,16
	...
	2021.02.13.10.37.00	1,8	2,16
	2021.02.13.14.30.37	1,8	2,8
2021-02-14 11:21:37 +00:00
isaki 44db56f660 Add missing curlwp_bindx() corresponding to curlwp_bind().
Pointed out by riastradh@.
2021-02-14 03:41:13 +00:00
joerg 0cf30132cd Adjust test cases to hit the fudge case after the changes in nbperf
itself.
2021-02-14 01:27:33 +00:00
rillig 1131246067 tests/libcurses: note that addbytes is not part of the API
https://mail-index.netbsd.org/source-changes-d/2021/02/13/msg013199.html
2021-02-13 22:19:47 +00:00
rillig 73417462e0 tests/libcurses: protect against short writes
The previous code only errored out if a write failed completely.  If it
was partially written, the program continued without writing the rest of
it.

Extract the common code into a few functions that write raw data to the
parent process.
2021-02-13 19:23:11 +00:00
rillig 9966483c8a tests/libcurses: remove unused code in linter 2021-02-13 18:24:11 +00:00
ryo 27267eb2dc No assignment is needed here.
the loop in pmap_page_remove() always removes the first pv,
and since the list is managed by _pmap_remove_pv(), pp->pp_pv.pv_next always points to the first.
2021-02-13 18:13:53 +00:00
rillig f48ee0a965 tests/libcurses: use ASCII only in terminfo description 2021-02-13 16:43:12 +00:00
rillig c12d26a726 tests/libcurses: split terminfo entry over more lines
This provides space to see each capability on its own, instead of having
to search them in the blob of text.
2021-02-13 16:38:02 +00:00
jakllsch 0f338aab04 Curb aprint_*() abuse in bnx(4) 2021-02-13 16:33:30 +00:00
jakllsch 4cbe52e587 Add aprint_*() newlines for viadrmums(4) attach
From Andrius V in kern/55884
2021-02-13 15:42:15 +00:00
martin 8d9b89d19f PR 55991: when extending the marked partition (typically: the NetBSD root
partition) round the new size up to current alignment.

This may lead to a slightly smaller than initialy planned last partition
(depending on order added) if the disk size is odd or the partitioning
scheme needs some internal space (like GPT) - but it avoids gaps elsewhere
due to alignement.

Ideally we would pin all other partitions in a first pass and then let
the partitioning backend pick the full available size for the extended
partition, but this should be good enough.
2021-02-13 15:31:35 +00:00
rillig 609d11bc47 libcurses: fix wrong tab width for addch
In sysinst, the installation screen is indented with tabs.  Sysinst uses
msgc, which brings its own text layout engine.  This engine does not use
addbytes but addch.  In addch, the x position for each tab was advanced
twice as much as needed.  The menu items were thus not indented by 8
spaces but by 16, which caused an ugly line break in the German
translation.

This bug largely went unnoticed because most other applications use
addbytes instead, which worked fine all the time.  It had been
introduced somewhere between NetBSD 8.0 and NetBSD 9.0.

The code around this bug used aliased variables for win->curx and
win->cury a lot.  Getting this right is difficult and needs a thorough
test suite.  Even though libcurses has 201 tests, that is not nearly
enough to cover all the relations between the various functions in
libcurses that call each other, crossing API boundaries from internal
to external, doing character conversions on the way and juggling around
4 different types of characters (char, wchar_t, chtype, cchar_t).

The simplest fix was to remove all this aliasing, while keeping the
API the same.  If _cursesi_waddbytes is not considered part of the API,
it would be possible to replace px with win->curx in all places, same
for py and win->cury.

The complicated code with the aliasing may have been meant for
performance reasons, but it's hard to see any advantage if both points
of truth need to be synchronized all the time.

Libcurses can be built in 2 modes: with wide character support or
without (-DDISABLE_WCHAR).  The test suite only covers the variant with
wide characters.  The single-byte variant has to be tested manually.
Running sysinst with the single-byte libcurses produces the correct
layout.
2021-02-13 14:30:37 +00:00
roy cb6917aa0d Prior alignment fixes should not use an offset 2021-02-13 13:00:16 +00:00
rillig 76716cd400 curses.h: proofread, indent a bit more consistently 2021-02-13 10:37:00 +00:00
rillig 86536876fb tests/libcurses: extract read_command_argument from process_commands
Having code indented so far to the right that each word gets its own
line is ridiculous.  Fix that.

While here, remove the cargo-cult realloc pattern, which is not needed
if the process exits immediately on error.

While here, reduce the indentation of the code by returning early.

No functional change.
2021-02-13 10:03:49 +00:00
rillig 78dd027b59 tests/libcurses: fix reading from the parent process
In case of a short read, processing the incomplete data invoked
undefined behavior.
2021-02-13 09:28:27 +00:00
rillig 2eec569208 tests/libcurses: fix child process handling
The child process needs to be properly controlled by the parent process.
Otherwise it is not possible to get code coverage data from it using
gcov since that requires the child process to exit normally.  Previously
the child process had been killed because its parent had exited.
2021-02-13 09:18:12 +00:00
rillig 2d435e1f5f tests/libcurses: fix error messages 2021-02-13 08:43:03 +00:00
rillig c671531bee tests/libcurses: "fix" test mvwin
The test mvwin previously expected an endless stream of bytes, by
comparing the actual output with /dev/zero.  This didn't make sense as
the curses output does not contain '\0' in any of the test cases.

Compare with /dev/null instead.  This is as wrong as before, but the
curses test framework currently ignores this situation, as for many
other test cases.  See the numerous "Excess" messages in atf-run.log.
2021-02-13 08:37:21 +00:00
rillig 08813b709b tests/libcurses: remove undocumented, unused command line option
The option -T has the same effect as the removed option -p.
2021-02-13 08:26:12 +00:00
rillig dcdcb866a3 tests/libcurses: remove include path from usage message
The option has been removed a few minutes ago.
2021-02-13 08:22:34 +00:00
rillig 177fdb97a1 tests/libcurses: clean up remaining include guard, comments
No functional change.
2021-02-13 08:17:15 +00:00
rillig cf012ad48f tests/libcurses: clean up inclusion guards, function declarations
No functional change.
2021-02-13 08:14:46 +00:00
rillig dfef510f35 tests/libcurses: remove include path handling
All include commands in the current test suite use relative paths.
Instead of a fixed include path, interpret the included filename
relative to the including file.
2021-02-13 08:00:07 +00:00
roy dd39d07da7 if_arp: Ensure that arphdr is aligned 2021-02-13 07:57:09 +00:00
rillig 8e1e8b7233 tests/libcurses: align comments 2021-02-13 07:32:19 +00:00
rillig c8713e3dc5 tests/libcurses: fix misleading usage documentation
The check-files are not config files.
2021-02-13 07:31:07 +00:00
roy 1aaed635b1 if_ether: Ensure that ether_header is aligned 2021-02-13 07:28:04 +00:00
rillig 1b4c237756 tests/libcurses: fix pipe handling in the parent process
The parent process, like the child process, needs only 2 of the 4 pipe
ends.

In verbose mode (now at testlang_parse.y:1151 and :1154), both ends of the
pipe_from_slave were examined.  This looked like a typo and has been fixed
to those pipe ends that are relevant to the parent process.
2021-02-13 07:08:45 +00:00
rillig 26ce28a5a0 tests/libcurses: fix pipe handling in child process
The child process only ever needs 2 ends of the pipes: one for reading
the commands, one for writing back the results.
2021-02-13 06:45:42 +00:00
rillig ff6217c297 tests/libcurses: add test for addbytes 2021-02-13 06:29:45 +00:00
dholland aad6139743 Document EINVAL for invalid flags given to fsync_range(). 2021-02-13 06:24:08 +00:00
rillig 2f4dbca7fd tests/libcurses: fix warnings for missing environment variables 2021-02-13 05:38:16 +00:00
thorpej 9411508aff Improve readability of this file by adding register prefixes. 2021-02-13 02:17:02 +00:00