summaryrefslogtreecommitdiff
path: root/tests/lib/libcurses
AgeCommit message (Collapse)Author
2021-12-07tests/libcurses: fix grammar in comment (since yesterday)rillig
2021-12-06tests/libcurses: clean up commentsrillig
2021-11-16Add more testing for special character handling in ins_wstr family.blymn
2021-11-15Add handling for backspace special character (\b)blymn
2021-11-15Update the ins_(n)wstr test family to split out the check filesblymn
for each call separately and update check files to reflect changed behaviour due to a fix to related calls.
2021-09-07PR lib/56388rin
Regen addstr2.chk after fix for the line-hash bug in libcurses. Now, all t_curses tests successfully pass on all platforms I have tried. Thanks blymn@ for kind advice!
2021-09-04Cosmetic fixes. No functional changes intended.rin
- Reorganize logic to reduce indent levels significantly. - Use ``for'' rather than ``while''.
2021-08-21fix some more typos in comments/log messages, improve wording as well.andvar
2021-06-22Update the check files to account for fixes to addstr.cblymn
2021-06-22Fix slk test and check files due to libcurses slk changes.blymn
2021-06-15Restore the slk_wset test after fixing a but in libcurses.blymn
2021-06-13tests/libcurses: fix argument handling for mvwget_wchrillig
There's currently no test for that function, therefore no functional change.
2021-06-13tests/libcurses: make error handling in the linter simplerrillig
2021-06-13tests/libcurses: improve code locality in linterrillig
No functional change.
2021-06-13tests/libcurses: improve local variable names in linterrillig
2021-06-13tests/libcurses: unexport argument handling functionsrillig
No functional change.
2021-06-13tests/libcurses: KNF for while looprillig
2021-06-13tests/libcurses: remove redundant argument numbersrillig
Since all arguments are processed in increasing order, there is no need to add the redundant argument numbers. Most of the curses functions have less than 5 arguments, which makes it easy enough to count the ARG macros. Changes to curses_commands.c: * replace ^(\tARG_\w+\()\d(?:, |) with $1 * replace (define ARG_\w+\()i,\s with $1 * replace args\[i\] with *args++ * replace \(i\) with () * replace \(void\)0 with args++ The wrong argument count in cmd_mvwget_wch is still detected by lint.lua, as it was before. There is no test yet that covers this function.
2021-06-13tests/libcurses: add parentheses around argument to sizeofrillig
2021-06-13tests/libcurses: sprinkle 'const', normalize sizeofrillig
No functional change.
2021-06-10Unset ESCDELAY in libcurses test director to ensure consistent resultsmcf
Non-default values of ESCDELAY may result in unexpected test failures.
2021-06-06New tests and updates for corrected behaviour due to fix for PR56224blymn
* Added extra testing to the addstr test to demonstrate bug described in PR#56224 and validate case when scrolling enabled still works. * Fixed slk test, the slk_init output changed due to corrected wrapping, slk_restore no longer returns ERR probably due to addwchar no longer returning ERR when an implicit scroll was attempted when scrolling disabled. Commented out the slk_wset test, this is now returning ERR instead of misbehaving, needs investigation.
2021-06-05Convert % into %% in input string so printf won't barfblymn
2021-06-05Decouple the clear test from the addstr test, they should not be linkedblymn
together because they are not really related.
2021-06-05Add new check file for the clear test.blymn
2021-06-04Fix debug_test so it actually works and does not do damageblymn
* disable blind clearing of /tmp. The comment says this is needed for getwin/putwin those tests need to be looked at to correct this. * remove invalid -I option from director arguments for now. * fix paths to executables so debug_test will work with installed versions by default the previous version was using the src tree locations but basedir was wrong for that.
2021-04-06tests/libcurses: fix names of over-the-wire data typesrillig
The test 'mvscanw' reported that it would send '%s' as 'numeric', which was rather suspicious.
2021-04-06tests/libcurses: clean up table of input functionsrillig
The previous "table" was an insult to any reader. It was unsorted, listed the functions shuffled, and was not even formatted consistently. No functional change.
2021-04-06tests/libcurses: don't waste time calling strlen needlesslyrillig
2021-04-04Reapply fix for big-endian environments, which was lost when GSoC resultsrin
were merged... http://www.nerv.org/netbsd/?q=id:20200620T075016Z.3584036ccf31f69ee76ea4a02e9be30ff081df21 > Fix false positive for mvscanw tests on big endian machines. > > When conversion specifier is not a derivative form of "%s", retrieve > input as 32bit integer, and then convert to string literal. Then we > can avoid interpretation from ASCII code to integer, which is > apparently byte-order depended.
2021-04-04When mvscanw(3) fails, string is not modified.rin
Let's ignore the 2nd result for this case.
2021-04-04s/&string/string/ for mvscanw(3); string is already pointer to buffer.rin
2021-02-25tests/libcurses: add test for '\b' in addchrillig
Just to ensure that addch and addstr behave the same, after the recent fix for handling '\t'.
2021-02-25tests/libcurses: use common style for parse error messagesrillig
2021-02-25tests/libcurses: use common syntax for accessing array elementsrillig
Writing *(p+1) is needlessly confusing, even though it adds a little symmetry between *p and *(p+1). Still, one of these expressions has parentheses, the other doesn't, which breaks the symmetry. Wrap overly long code line. It's confusing to refer to the digits after the backslash once with index 0 to 2, and the other time with index 1 to 3.
2021-02-25tests/libcurses: reduce indentationrillig
No functional change.
2021-02-25libcurses: ensure that '\b' in handled correctly in addstrrillig
Just to ensure that the recent fix for '\t' handling in addstr/addch didn't introduce another bug.
2021-02-25libcurses: prevent unknown escpae sequences in testsrillig
Before, '\b' was interpreted as a simple 'b', which is confusing for C programmers. Same for '\a'. There is absolutely no reason to escape letters, so fail early in these cases. The '\h' in the test addchstr was obviously a typo that was easy to detect, if only the compiler had been strict enough from the very beginning. The code is wider than 80 characters, same as the code that parses octal escape sequences a few lines above it. This code will be refactored to use less indentation in a follow-up commit.
2021-02-15Simplify to avoid copy based on the size of the source.joerg
2021-02-15tests/libcurses: fix error handling for non-system errorsrillig
These errors are unrelated to errno. The scanf family of functions also does not set errno.
2021-02-14tests/libcurses: document the history about tab bugs in addch/addstrrillig
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-13tests/libcurses: note that addbytes is not part of the APIrillig
https://mail-index.netbsd.org/source-changes-d/2021/02/13/msg013199.html
2021-02-13tests/libcurses: protect against short writesrillig
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-13tests/libcurses: remove unused code in linterrillig
2021-02-13tests/libcurses: use ASCII only in terminfo descriptionrillig
2021-02-13tests/libcurses: split terminfo entry over more linesrillig
This provides space to see each capability on its own, instead of having to search them in the blob of text.
2021-02-13libcurses: fix wrong tab width for addchrillig
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-13tests/libcurses: extract read_command_argument from process_commandsrillig
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-13tests/libcurses: fix reading from the parent processrillig
In case of a short read, processing the incomplete data invoked undefined behavior.
2021-02-13tests/libcurses: fix child process handlingrillig
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.