aboutsummaryrefslogtreecommitdiff
path: root/testsuite (follow)
Commit message (Collapse)AuthorAgeFilesLines
* join: add some more testsRon Yorston2026-01-231-0/+30
| | | | | One more from the POSIX documentation and some examples from coreutils.
* Merge branch 'busybox' into mergeRon Yorston2026-01-224-9/+81
|\
| * md5/sha1sum: Honor the -b flag in the outputMartin Storsjö2026-01-181-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The output of md5sum/sha1sum contains a character to indicate what mode was used to read the file - '*' for binary, and ' ' for text or where binary is insignificant. This flag character makes a difference for the ffmpeg testsuite. This testsuite contains a number of reference files (e.g. [1]), containing the expected md5sum output for those files, which is checked verbatim. By making busybox's md5sum honor this flag in the output, ffmpeg's testsuite can run successfully on top of busybox. The flag is only partially implemented; in coreutils md5sum, a later "-t" option overrides an earlier "-b" option. Here, just check if a "-b" option was specified or not. Neither flag affects how the files actually are read. [1] https://code.ffmpeg.org/FFmpeg/FFmpeg/src/commit/894da5ca7d742e4429ffb2af534fcda0103ef593/tests/ref/acodec/flac Signed-off-by: Martin Storsjö <martin@martin.st> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cmp: fix -n causing all diffs to be output, implement size suffixes for SKIPDenys Vlasenko2026-01-182-9/+54
| | | | | | | | | | | | | | | | | | | | function old new delta packed_usage 35802 35828 +26 cmp_main 616 595 -21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 26/-21) Total: 5 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * xxd: fix -pANYTHING handling (-pc50 does not mean -p -c50)Denys Vlasenko2025-11-301-0/+19
| | | | | | | | | | | | | | | | | | | | | | function old new delta packed_usage 35768 35802 +34 xxd_main 1447 1449 +2 .rodata 106438 106439 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 37/0) Total: 37 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | md5/sha1sum: Honor the -b flag in the outputMartin Storsjö2026-01-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The output of md5sum/sha1sum contains a character to indicate what mode was used to read the file - '*' for binary, and ' ' for text or where binary is insignificant. This flag character makes a difference for the ffmpeg testsuite. This testsuite contains a number of reference files (e.g. [1]), containing the expected md5sum output for those files, which is checked verbatim. By making busybox's md5sum honor this flag in the output, ffmpeg's testsuite can run successfully on top of busybox. The flag is only partially implemented; in coreutils md5sum, a later "-t" option overrides an earlier "-b" option. Here, just check if a "-b" option was specified or not. Neither flag affects how the files actually are read. [1] https://code.ffmpeg.org/FFmpeg/FFmpeg/src/commit/894da5ca7d742e4429ffb2af534fcda0103ef593/tests/ref/acodec/flac Signed-off-by: Martin Storsjö <martin@martin.st>
* | join: minor adjustmentsRon Yorston2026-01-021-0/+15
| | | | | | | | | | | | | | | | - Update the size estimate to follow upstream's methodology - Disable the applet by default until it's accepted upstream - Add a minimal test script, stealing an example from POSIX
* | make: fix expansion of immediate-mode macrosRon Yorston2025-11-281-0/+18
| | | | | | | | | | | | | | | | | | Immediate-mode macros shouldn't be recursively expanded, but are subject to suffix and pattern substitution. Adds 16 bytes to the 32-bit build. (pdpmake GitHub issue 77)
* | paste: fix output when file lengths differRon Yorston2025-11-102-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | If the files being pasted had different numbers of lines the output was incorrect. Rewrite the loop over all lines to allow for this. Add tests for such conditions. Adds 64-80 bytes. (GitHub issue #542)
* | tr: an escaped dash doesn't indicate a rangeRon Yorston2025-08-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Upstream commit d683c5c2f1 (tr: support octal ranges) broke the previous behaviour that an escaped dash doesn't indicate a range: '[p\-r]' should match 'p', '-' or 'r', not 'p', 'q' or 'r'. Add a special case to handle this. Adds 16 bytes. (GitHub issue #515)
* | Merge branch 'busybox' into mergeRon Yorston2025-08-155-6/+46
|\|
| * ls: fix -Q to match GNUDenys Vlasenko2025-08-012-2/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta print_name 137 229 +92 display_files 375 402 +27 c_escape_conv_str00 - 24 +24 display 1476 1485 +9 conv_str 33 - -33 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 3/0 up/down: 152/-33) Total: 119 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * sha3sum: add -aBITS testsDenys Vlasenko2025-07-302-4/+8
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * sha384sum: new appletAndy Knowles2025-07-302-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta sha512384_end - 198 +198 packed_usage 35021 35134 +113 init384 - 80 +80 sha384_begin - 19 +19 sha384_end - 10 +10 applet_names 2823 2833 +10 md5_sha1_sum_main 501 507 +6 sha3_end 54 59 +5 applet_main 1628 1632 +4 show_usage_if_dash_dash_help 79 72 -7 hash_file 358 344 -14 sha512_end 197 10 -187 ------------------------------------------------------------------------------ (add/remove: 4/0 grow/shrink: 5/3 up/down: 445/-208) Total: 237 bytes Signed-off-by: Andy Knowles <aknowles@galleonec.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2025-08-121-13/+85
|\|
| * libbb/yescrypt: actually, largest allowed salt is 86 chars, support thatDenys Vlasenko2025-07-171-3/+7
| | | | | | | | | | | | | | function old new delta yescrypt_r 767 756 -11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cryptpw: -m sha512crypt must also be acceptedDenys Vlasenko2025-07-071-0/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb/yescrypt: fix salts ending in dots (corresponding to binary zeros)Denys Vlasenko2025-07-071-0/+20
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb/yescrypt: accept longer salts (up to 84 chars)Denys Vlasenko2025-07-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta cryptpw_main 214 223 +9 chpasswd_main 347 356 +9 passwd_main 931 934 +3 yescrypt_r 1084 1056 -28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 21/-28) Total: -7 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb/yescrypt: make it possible to set constant parameters, and set YESCRYPT_RWDenys Vlasenko2025-07-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | function old new delta yescrypt_kdf32_body 1052 1420 +368 yescrypt_r 1133 1084 -49 static.smix 762 - -762 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/1 up/down: 368/-811) Total: -443 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: add yescrypt password hashing supportDenys Vlasenko2025-07-061-13/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems to work, but not at all optimized for size. The extra copy of sha256 code need to be removed. The yescrypt code in libbb/yescrypt/* is adapted from libxcrypt-4.4.38 with minimal edits, hopefully making it easier to track backports by resetting the tree to this commit, then comparing changes in upstream libxcrypt to the tree. function old new delta blockmix_xor_save - 7050 +7050 static.blockmix_xor - 6475 +6475 blockmix - 3390 +3390 SHA256_Transform - 3083 +3083 yescrypt_kdf_body - 1724 +1724 PBKDF2_SHA256 - 1003 +1003 smix1 - 960 +960 yescrypt_r - 890 +890 salsa20 - 804 +804 smix - 790 +790 smix2 - 659 +659 blockmix_salsa8_xor - 601 +601 yescrypt_kdf - 479 +479 blockmix_salsa8 - 415 +415 Krnd - 256 +256 _HMAC_SHA256_Init - 213 +213 _SHA256_Update - 198 +198 _SHA256_Final - 195 +195 decode64_uint32 - 166 +166 encode64 - 153 +153 decode64 - 136 +136 libcperciva_HMAC_SHA256_Buf - 132 +132 SHA256_Pad_Almost - 131 +131 salsa20_simd_unshuffle - 101 +101 salsa20_simd_shuffle - 101 +101 yes_crypt - 90 +90 libcperciva_SHA256_Buf - 86 +86 crypt_make_rand64encoded - 85 +85 static.atoi64_partial - 77 +77 alloc_region - 72 +72 ascii64 - 65 +65 PAD - 64 +64 _HMAC_SHA256_Final - 55 +55 static.cpu_to_be32_vect - 51 +51 free_region - 47 +47 libcperciva_SHA256_Init - 37 +37 yescrypt_init_local - 34 +34 crypt_make_pw_salt 92 125 +33 initial_state - 32 +32 .rodata 105771 105803 +32 atoi64 - 25 +25 explicit_bzero - 22 +22 pw_encrypt 920 941 +21 yescrypt_free_local - 9 +9 crypt_make_salt 85 - -85 ------------------------------------------------------------------------------ (add/remove: 43/1 grow/shrink: 3/0 up/down: 31042/-85) Total: 30957 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2025-08-102-23/+81
|\|
| * hexdump: add tests for %x, handle little/big endian properlyRadoslav Kolev2025-07-011-22/+69
| | | | | | | | | | Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * od: make -B test little endian only, add variant for big endianRadoslav Kolev2025-07-011-1/+12
| | | | | | | | | | Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | testsuite: check that wget handles httpsRon Yorston2025-07-111-0/+4
| | | | | | | | | | | | We failed to notice a problem with the native Windows crypto support for TLS because there was no test. Add a test case, using wget to fetch an https URL.
* | Merge branch 'busybox' into mergeRon Yorston2025-05-191-0/+23
|\|
| * archival: disallow path traversals (CVE-2023-39810)Denys Vlasenko2025-04-161-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create new configure option for archival/libarchive based extractions to disallow path traversals. As this is a paranoid option and might introduce backward incompatibility, default it to no. Fixes: CVE-2023-39810 Based on the patch by Peter Kaestle <peter.kaestle@nokia.com> function old new delta data_extract_all 921 945 +24 strip_unsafe_prefix 101 102 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 25/0) Total: 25 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | make: fix single-suffix inference rule regressionRon Yorston2025-01-211-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | Commit 85bbce87d (make: support GNU/BSD suffixes and inference rules) added code to handle inference rules with arbitrary suffixes. Unfortunately it failed to check for a single-suffix rule in the case where no known suffix was found. Add the necessary code and a test which would have caught the problem. Adds 48 bytes. (pdpmake GitHub issue 72)
* | make: support GNU/BSD suffixes and inference rulesRon Yorston2025-01-141-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The specification of inference rules in POSIX implies that only suffixes starting with a period and containing no other periods are to be considered. In contrast, both GNU and BSD make allow suffixes to contain an arbitrary number of periods, or none at all. Allow this as an extension. Adds 640-816 bytes. (pdpmake GitHub issue 70)
* | Merge branch 'busybox' into mergeRon Yorston2024-12-302-12/+134
|\|
| * cut: fix up -D/-s behavior with -FDenys Vlasenko2024-12-201-2/+33
| | | | | | | | | | | | | | | | | | | | function old new delta cut_main 1388 1402 +14 packed_usage 34934 34933 -1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 14/-1) Total: 13 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: fix -F n-m to match toyboxDenys Vlasenko2024-12-141-3/+18
| | | | | | | | | | | | | | function old new delta cut_main 1339 1391 +52 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: fix handling of -d ''Denys Vlasenko2024-12-131-0/+12
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: fix -d$'\n' --output-delimiter=@@ behaviorDenys Vlasenko2024-12-101-0/+26
| | | | | | | | | | | | | | | | | | | | function old new delta cut_main 1261 1353 +92 packed_usage 34925 34901 -24 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 92/-24) Total: 68 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: implement --output-delimiterDenys Vlasenko2024-12-101-8/+24
| | | | | | | | | | | | | | | | | | | | function old new delta cut_main 1204 1261 +57 static.cut_longopts - 20 +20 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 77/0) Total: 77 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: fix "echo 1.2 | cut -d. -f1,3" (print "1", not "1.")Denys Vlasenko2024-12-101-2/+9
| | | | | | | | | | | | | | function old new delta cut_main 1228 1201 -27 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: improve detection of invalid rangesRon Yorston2024-12-101-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 0068ce2fa (cut: add toybox-compatible options -O OUTSEP, -D, -F LIST) added detection of reversed ranges. Further improvements are possible. - The test for reversed ranges compared the start after it had been decremented with the end before decrement. It thus missed ranges of the form 2-1. - Zero isn't a valid start value for a range. (Nor is it a valid end value, but that's caught by the test for a reversed range.) - The code if (!*ltok) e = INT_MAX; duplicates a check that's already been made. - Display the actual range in the error message to make it easier to find which range was at fault. function old new delta .rodata 100273 100287 +14 cut_main 1239 1237 -2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 14/-2) Total: 12 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cut: fix "-s" flag to omit blank linesColin McAllister2024-12-101-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using cut with the delimiter flag ("-d") with the "-s" flag to only output lines containing the delimiter will print blank lines. This is deviant behavior from cut provided by GNU Coreutils. Blank lines should be omitted if "-s" is used with "-d". This change introduces a somewhat naiive, yet efficient solution, where line length is checked before looping though bytes. If line length is zero and the "-s" flag is used, the code will jump to parsing the next line to avoid printing a newline character. function old new delta cut_main 1196 1185 -11 Signed-off-by: Colin McAllister <colinmca242@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hexdump: fix regression with -n4 -e '"%u"'Natanael Copa2024-12-091-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Fix bug introduced in busybox 1.37.0 that broke kernel builds. Fixes commit e2287f99fe6f (od: for !DESKTOP, match output more closely to GNU coreutils 9.1, implement -s) function old new delta rewrite 967 976 +9 Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ed: fix line insertion before current line. Closes 15081Ron Yorston2024-09-271-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When text is inserted by insertLine() the lines following the insertion are moved down and the insertion point is made the new current line. To avoid too much scanning of the linked list of lines setCurNum() may use the position of the old current line to determine the location of the new current line. If the insertion point is before the old current line in the file the latter will have been moved down, so its line pointer needs to be adjusted. function old new delta insertLine 162 180 +18 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 18/0) Total: 18 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | cut: detect error when bounds are reversedRon Yorston2024-10-221-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | The command 'cut -b 3-2' failed to detect that the bounds were incorrectly ordered, though the check worked when the difference between the bounds was larger. The comparison was made after the lower bound has been decremented but before the upper bound had. Adds 0-16 bytes. (GitHub issue #467)
* | make: changes to .DEFAULT/inference rulesRon Yorston2024-10-201-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The POSIX standard allows inference rules to be redefined but not the .DEFAULT rule. There is no explicit exception for .DEFAULT to: Only one target rule for any given target can contain commands. Treat redefinition of a .DEFAULT rule as an error in POSIX mode but allow it as an extension. Also, the code didn't allow an inference rule with dependencies to redefine an existing inference rule. This is no longer the case. Adds 64-96 bytes.
* | make: reinstate conditional skipping of command linesRon Yorston2024-09-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit e90345c10 (make: allow empty commands) rearranged readline() in a way that broke the use of conditionals within the definition of a rule. Add a test case to detect this. Adjust readline() so that conditionals are processed before returning command lines or checking for empty lines and comments. Remove the test for a leading tab in skip_lines(). This allows conditionals in the definition of a rule to be indented with a leading tab.
* | make: disallow inference rules for phony targetsRon Yorston2024-08-101-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | GNU make doesn't allow inference rules or the .DEFAULT target to be used for phony targets. POSIX is unclear on the matter but there doesn't seem to be an explicit prohibition of inference rules or .DEFAULT. Follow the GNU make behaviour as a non-POSIX extension. Adds 48-80 bytes. (pdpmake GitHub issue 56)
* | make: allow empty commandsRon Yorston2024-08-081-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pdpmake didn't allow rules to have empty commands. There are circumstances where this may be useful. Make the following changes: - Add a flag to readline() to indicate the next line is expected to be a command. If this flag is true and the input line starts with a tab return it immediately, thus skipping the check for an empty line or comment line. - In docmds() skip tabs and spaces after a command prefix. If the resulting command is empty don't print it or try to execute it. - In newcmd() allow empty commands. Adds 48-96 bytes. (pdpmake GitHub issue 56)
* | ed: fix line insertion before current lineRon Yorston2024-07-181-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When text is inserted by insertLine() the lines following the insertion are moved down and the insertion point is made the new current line. To avoid too much scanning of the linked list of lines setCurNum() may use the position of the old current line to determine the location of the new current line. If the insertion point is before the old current line in the file the latter will have been moved down, so its line pointer needs to be adjusted. (GitHub issue #431)
* | Merge branch 'busybox' into mergeRon Yorston2024-07-101-11/+20
|\|
| * awk: restore assignment precedence to be lower than ternary ?:Denys Vlasenko2024-07-091-11/+20
| | | | | | | | | | | | | | Something is fishy with constrcts like "3==v=3" in gawk, they should not work, but do. Ignore those for now. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | make: update for POSIX 2024Ron Yorston2024-06-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Now that POSIX.1-2024 has been released we can replace all references to the 202X draft standard with 2024. Make this change throughout the code and testsuite. The pragma 'posix_2024' has been added. 'posix_202x' remains as an alias for the same. The 2024 standard is enforced by default in POSIX mode.
* | make: move test for complex chain of macro assignmentsRon Yorston2024-06-011-14/+14
| | | | | | | | | | | | The test 'Complex chain of macro assignments' relies on recursive macro expansion. This is a POSIX 202X feature, so the test should be moved to the appropriate section of the test script.