From 4aca87515a5083ae0e31ce3177189fd43b6d05ac Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 3 Jan 2015 13:58:15 +0100 Subject: patch to Vanilla Tomato 1.28 --- release/src/router/busybox/testsuite/README | 4 +- release/src/router/busybox/testsuite/TODO | 28 +- .../router/busybox/testsuite/all_sourcecode.tests | 92 ++++ release/src/router/busybox/testsuite/awk.tests | 50 ++ .../src/router/busybox/testsuite/awk_t1.tar.bz2 | Bin 0 -> 15955 bytes .../basename-does-not-remove-identical-extension | 0 .../busybox/testsuite/basename/basename-works | 2 + release/src/router/busybox/testsuite/bunzip2.tests | 524 +++++++++++++++++++++ .../bunzip2/bunzip2-reads-from-standard-input | 0 .../bunzip2/bunzip2-removes-compressed-file | 0 .../bunzip2/bzcat-does-not-remove-compressed-file | 0 release/src/router/busybox/testsuite/busybox.tests | 46 ++ release/src/router/busybox/testsuite/bzcat.tests | 49 ++ .../router/busybox/testsuite/cat/cat-prints-a-file | 0 .../cat/cat-prints-a-file-and-standard-input | 0 .../busybox/testsuite/cmp/cmp-detects-difference | 8 +- release/src/router/busybox/testsuite/comm.tests | 19 + .../testsuite/cp/cp-RHL-does_not_preserve-links | 6 + .../router/busybox/testsuite/cp/cp-a-files-to-dir | 15 + .../busybox/testsuite/cp/cp-a-preserves-links | 5 + .../busybox/testsuite/cp/cp-copies-empty-file | 0 .../busybox/testsuite/cp/cp-copies-large-file | 0 .../busybox/testsuite/cp/cp-copies-small-file | 0 .../router/busybox/testsuite/cp/cp-d-files-to-dir | 11 + .../src/router/busybox/testsuite/cp/cp-dev-file | 2 + .../router/busybox/testsuite/cp/cp-dir-create-dir | 4 + .../busybox/testsuite/cp/cp-dir-existing-dir | 5 + .../testsuite/cp/cp-does-not-copy-unreadable-file | 9 +- .../router/busybox/testsuite/cp/cp-files-to-dir | 11 + .../router/busybox/testsuite/cp/cp-follows-links | 0 .../busybox/testsuite/cp/cp-preserves-hard-links | 0 .../router/busybox/testsuite/cp/cp-preserves-links | 1 + .../busybox/testsuite/cp/cp-preserves-source-file | 0 release/src/router/busybox/testsuite/cpio.tests | 83 ++++ release/src/router/busybox/testsuite/cut.tests | 18 + .../busybox/testsuite/cut/cut-cuts-a-character | 0 .../busybox/testsuite/cut/cut-cuts-a-closed-range | 0 .../router/busybox/testsuite/cut/cut-cuts-a-field | 0 .../busybox/testsuite/cut/cut-cuts-an-open-range | 0 .../testsuite/cut/cut-cuts-an-unclosed-range | 0 .../src/router/busybox/testsuite/date/date-R-works | 1 + .../busybox/testsuite/date/date-format-works | 4 + .../src/router/busybox/testsuite/date/date-u-works | 1 + .../src/router/busybox/testsuite/date/date-works | 44 ++ .../src/router/busybox/testsuite/date/date-works-1 | 129 +++++ .../src/router/busybox/testsuite/dd/dd-accepts-if | 0 .../src/router/busybox/testsuite/dd/dd-accepts-of | 0 ...d-copies-from-standard-input-to-standard-output | 0 .../testsuite/dd/dd-prints-count-to-standard-error | 0 .../busybox/testsuite/dd/dd-reports-write-errors | 2 + release/src/router/busybox/testsuite/diff.tests | 124 +++++ .../dirname/dirname-handles-absolute-path | 0 .../testsuite/dirname/dirname-handles-empty-path | 0 .../dirname/dirname-handles-multiple-slashes | 0 .../dirname/dirname-handles-relative-path | 0 .../busybox/testsuite/dirname/dirname-handles-root | 0 .../dirname/dirname-handles-single-component | 0 .../router/busybox/testsuite/dirname/dirname-works | 2 + release/src/router/busybox/testsuite/du/du-h-works | 4 + release/src/router/busybox/testsuite/du/du-k-works | 4 + release/src/router/busybox/testsuite/du/du-l-works | 4 + release/src/router/busybox/testsuite/du/du-m-works | 4 + release/src/router/busybox/testsuite/du/du-s-works | 4 + release/src/router/busybox/testsuite/du/du-works | 4 + .../testsuite/echo/echo-does-not-print-newline | 0 .../busybox/testsuite/echo/echo-prints-argument | 2 +- .../busybox/testsuite/echo/echo-prints-arguments | 0 .../busybox/testsuite/echo/echo-prints-newline | 0 .../busybox/testsuite/echo/echo-prints-slash-zero | 1 + release/src/router/busybox/testsuite/expand.tests | 15 + .../busybox/testsuite/expand/expand-works-like-GNU | 18 + release/src/router/busybox/testsuite/expr/expr-big | 16 + .../src/router/busybox/testsuite/expr/expr-works | 59 +++ .../router/busybox/testsuite/false/false-is-silent | 0 .../busybox/testsuite/false/false-returns-failure | 0 .../testsuite/find/find-supports-minus-xdev | 1 - release/src/router/busybox/testsuite/grep.tests | 88 ++++ .../testsuite/grep/egrep-is-not-case-insensitive | 2 - .../testsuite/grep/egrep-supports-extended-regexps | 2 - .../testsuite/grep/grep-handles-binary-files | 1 - .../testsuite/grep/grep-handles-multiple-regexps | 1 - .../busybox/testsuite/grep/grep-is-also-egrep | 2 - .../router/busybox/testsuite/grep/grep-matches-NUL | 2 - release/src/router/busybox/testsuite/gunzip.tests | 3 + .../gunzip/gunzip-reads-from-standard-input | 0 .../testsuite/gzip/gzip-accepts-multiple-files | 0 .../testsuite/gzip/gzip-accepts-single-minus | 0 .../testsuite/gzip/gzip-removes-original-file | 0 .../src/router/busybox/testsuite/head/head-n-works | 4 + .../src/router/busybox/testsuite/head/head-works | 4 + .../router/busybox/testsuite/hostid/hostid-works | 2 + .../busybox/testsuite/hostname/hostname-d-works | 2 + .../busybox/testsuite/hostname/hostname-i-works | 2 + .../busybox/testsuite/hostname/hostname-s-works | 1 + .../busybox/testsuite/hostname/hostname-works | 1 + release/src/router/busybox/testsuite/id/id-g-works | 1 + release/src/router/busybox/testsuite/id/id-u-works | 1 + .../src/router/busybox/testsuite/id/id-un-works | 1 + .../src/router/busybox/testsuite/id/id-ur-works | 1 + .../busybox/testsuite/ln/ln-creates-hard-links | 4 + .../busybox/testsuite/ln/ln-creates-soft-links | 4 + .../testsuite/ln/ln-force-creates-hard-links | 5 + .../testsuite/ln/ln-force-creates-soft-links | 5 + .../busybox/testsuite/ln/ln-preserves-hard-links | 8 + .../busybox/testsuite/ln/ln-preserves-soft-links | 9 + release/src/router/busybox/testsuite/ls/ls-1-works | 4 + release/src/router/busybox/testsuite/ls/ls-h-works | 4 + release/src/router/busybox/testsuite/ls/ls-l-works | 4 + release/src/router/busybox/testsuite/ls/ls-s-works | 4 + .../busybox/testsuite/makedevs.device_table.txt | 172 +++++++ .../src/router/busybox/testsuite/makedevs.tests | 139 ++++++ .../md5sum/md5sum-verifies-non-binary-file | 0 release/src/router/busybox/testsuite/mdev.tests | 143 ++++++ .../testsuite/mkdir/mkdir-makes-a-directory | 0 .../testsuite/mkdir/mkdir-makes-parent-directories | 0 .../src/router/busybox/testsuite/mkfs.minix.tests | 22 + .../src/router/busybox/testsuite/mount.testroot | 183 +++++++ release/src/router/busybox/testsuite/mount.tests | 35 ++ .../msh/msh-supports-underscores-in-variable-names | 0 .../router/busybox/testsuite/mv/mv-files-to-dir | 16 + .../router/busybox/testsuite/mv/mv-follows-links | 4 + .../busybox/testsuite/mv/mv-moves-empty-file | 4 + .../src/router/busybox/testsuite/mv/mv-moves-file | 0 .../router/busybox/testsuite/mv/mv-moves-hardlinks | 4 + .../busybox/testsuite/mv/mv-moves-large-file | 4 + .../busybox/testsuite/mv/mv-moves-small-file | 4 + .../router/busybox/testsuite/mv/mv-moves-symlinks | 6 + .../busybox/testsuite/mv/mv-moves-unreadable-files | 5 + .../busybox/testsuite/mv/mv-preserves-hard-links | 6 + .../router/busybox/testsuite/mv/mv-preserves-links | 5 + .../testsuite/mv/mv-refuses-mv-dir-to-subdir | 23 + .../busybox/testsuite/mv/mv-removes-source-file | 4 + release/src/router/busybox/testsuite/od.tests | 17 + release/src/router/busybox/testsuite/parse.tests | 109 +++++ release/src/router/busybox/testsuite/patch.tests | 65 +++ release/src/router/busybox/testsuite/pidof.tests | 31 ++ release/src/router/busybox/testsuite/printf.tests | 108 +++++ .../testsuite/pwd/pwd-prints-working-directory | 2 +- .../src/router/busybox/testsuite/readlink.tests | 32 ++ .../router/busybox/testsuite/rm/rm-removes-file | 0 .../rmdir/rmdir-removes-parent-directories | 0 release/src/router/busybox/testsuite/runtest | 185 +++++--- release/src/router/busybox/testsuite/sed.tests | 210 +++++++++ .../sed/sed-accepts-blanks-before-command | 1 - .../router/busybox/testsuite/sed/sed-aic-commands | 134 ------ .../router/busybox/testsuite/sed/sed-chains-substs | 1 - .../sed/sed-does-not-substitute-in-deleted-line | 2 - .../testsuite/sed/sed-handles-embedded-slashes | 1 - .../busybox/testsuite/sed/sed-handles-empty-lines | 1 - .../testsuite/sed/sed-handles-unsatisfied-backrefs | 6 - .../sed/sed-prints-line-once-for-multiple-substs | 4 - .../busybox/testsuite/sed/sed-recurses-properly | 2 - .../sed/sed-requires-newline-after-edit-command | 1 - .../sed/sed-splits-edit-commands-on-command-line | 9 - release/src/router/busybox/testsuite/seq.tests | 41 ++ release/src/router/busybox/testsuite/sort.tests | 119 +++++ .../busybox/testsuite/start-stop-daemon.tests | 19 + .../testsuite/strings/strings-works-like-GNU | 7 +- release/src/router/busybox/testsuite/sum.tests | 24 + .../src/router/busybox/testsuite/tail/tail-n-works | 4 + .../src/router/busybox/testsuite/tail/tail-works | 4 + .../testsuite/tar/tar-archives-multiple-files | 0 .../testsuite/tar/tar-complains-about-missing-file | 1 - .../testsuite/tar/tar-demands-at-least-one-ctx | 0 .../testsuite/tar/tar-demands-at-most-one-ctx | 0 .../busybox/testsuite/tar/tar-extracts-all-subdirs | 12 + .../router/busybox/testsuite/tar/tar-extracts-file | 0 .../testsuite/tar/tar-extracts-from-standard-input | 0 .../testsuite/tar/tar-extracts-multiple-files | 5 +- .../testsuite/tar/tar-extracts-to-standard-output | 0 .../busybox/testsuite/tar/tar-handles-cz-options | 3 +- ...andles-empty-include-and-non-empty-exclude-list | 3 +- .../tar/tar-handles-exclude-and-extract-lists | 3 +- .../testsuite/tar/tar-handles-multiple-X-options | 2 + .../testsuite/tar/tar-handles-nested-exclude | 3 +- .../busybox/testsuite/tar/tar_with_link_with_size | 29 ++ .../busybox/testsuite/tar/tar_with_prefix_fields | 261 ++++++++++ release/src/router/busybox/testsuite/taskset.tests | 17 + .../router/busybox/testsuite/tee/tee-appends-input | 0 .../router/busybox/testsuite/tee/tee-tees-input | 0 release/src/router/busybox/testsuite/test.tests | 79 ++++ release/src/router/busybox/testsuite/testing.sh | 154 ++++++ .../busybox/testsuite/touch/touch-creates-file | 0 .../testsuite/touch/touch-does-not-create-file | 0 .../touch-touches-files-after-non-existent-file | 0 release/src/router/busybox/testsuite/tr.tests | 31 ++ .../router/busybox/testsuite/tr/tr-d-alnum-works | 4 + release/src/router/busybox/testsuite/tr/tr-d-works | 4 + release/src/router/busybox/testsuite/tr/tr-non-gnu | 1 + .../busybox/testsuite/tr/tr-rejects-wrong-class | 19 + release/src/router/busybox/testsuite/tr/tr-works | 26 + .../router/busybox/testsuite/true/true-is-silent | 0 .../busybox/testsuite/true/true-returns-success | 0 release/src/router/busybox/testsuite/umlwrapper.sh | 20 + .../src/router/busybox/testsuite/unexpand.tests | 30 ++ .../testsuite/unexpand/unexpand-works-like-GNU | 52 ++ release/src/router/busybox/testsuite/uniq.tests | 87 ++++ release/src/router/busybox/testsuite/unzip.tests | 38 ++ .../router/busybox/testsuite/uptime/uptime-works | 2 + .../src/router/busybox/testsuite/uuencode.tests | 28 ++ .../uuencode-sets-standard-input-mode-correctly | 6 - .../src/router/busybox/testsuite/wc/wc-counts-all | 3 +- .../busybox/testsuite/wc/wc-counts-characters | 0 .../router/busybox/testsuite/wc/wc-counts-lines | 0 .../router/busybox/testsuite/wc/wc-counts-words | 0 .../testsuite/wc/wc-prints-longest-line-length | 0 .../busybox/testsuite/wget/wget--O-overrides--P | 0 .../busybox/testsuite/wget/wget-handles-empty-path | 0 .../testsuite/wget/wget-retrieves-google-index | 0 .../router/busybox/testsuite/wget/wget-supports--P | 0 .../testsuite/which/which-uses-default-path | 3 - release/src/router/busybox/testsuite/xargs.tests | 29 ++ .../src/router/busybox/testsuite/xargs/xargs-works | 4 + 213 files changed, 4209 insertions(+), 275 deletions(-) mode change 100755 => 100644 release/src/router/busybox/testsuite/TODO create mode 100755 release/src/router/busybox/testsuite/all_sourcecode.tests create mode 100755 release/src/router/busybox/testsuite/awk.tests create mode 100644 release/src/router/busybox/testsuite/awk_t1.tar.bz2 mode change 100755 => 100644 release/src/router/busybox/testsuite/basename/basename-does-not-remove-identical-extension create mode 100644 release/src/router/busybox/testsuite/basename/basename-works create mode 100755 release/src/router/busybox/testsuite/bunzip2.tests mode change 100755 => 100644 release/src/router/busybox/testsuite/bunzip2/bunzip2-reads-from-standard-input mode change 100755 => 100644 release/src/router/busybox/testsuite/bunzip2/bunzip2-removes-compressed-file mode change 100755 => 100644 release/src/router/busybox/testsuite/bunzip2/bzcat-does-not-remove-compressed-file create mode 100755 release/src/router/busybox/testsuite/busybox.tests create mode 100755 release/src/router/busybox/testsuite/bzcat.tests mode change 100755 => 100644 release/src/router/busybox/testsuite/cat/cat-prints-a-file mode change 100755 => 100644 release/src/router/busybox/testsuite/cat/cat-prints-a-file-and-standard-input mode change 100755 => 100644 release/src/router/busybox/testsuite/cmp/cmp-detects-difference create mode 100755 release/src/router/busybox/testsuite/comm.tests create mode 100644 release/src/router/busybox/testsuite/cp/cp-RHL-does_not_preserve-links create mode 100644 release/src/router/busybox/testsuite/cp/cp-a-files-to-dir create mode 100644 release/src/router/busybox/testsuite/cp/cp-a-preserves-links mode change 100755 => 100644 release/src/router/busybox/testsuite/cp/cp-copies-empty-file mode change 100755 => 100644 release/src/router/busybox/testsuite/cp/cp-copies-large-file mode change 100755 => 100644 release/src/router/busybox/testsuite/cp/cp-copies-small-file create mode 100644 release/src/router/busybox/testsuite/cp/cp-d-files-to-dir create mode 100644 release/src/router/busybox/testsuite/cp/cp-dev-file create mode 100644 release/src/router/busybox/testsuite/cp/cp-dir-create-dir create mode 100644 release/src/router/busybox/testsuite/cp/cp-dir-existing-dir mode change 100755 => 100644 release/src/router/busybox/testsuite/cp/cp-does-not-copy-unreadable-file create mode 100644 release/src/router/busybox/testsuite/cp/cp-files-to-dir mode change 100755 => 100644 release/src/router/busybox/testsuite/cp/cp-follows-links mode change 100755 => 100644 release/src/router/busybox/testsuite/cp/cp-preserves-hard-links mode change 100755 => 100644 release/src/router/busybox/testsuite/cp/cp-preserves-links mode change 100755 => 100644 release/src/router/busybox/testsuite/cp/cp-preserves-source-file create mode 100755 release/src/router/busybox/testsuite/cpio.tests create mode 100755 release/src/router/busybox/testsuite/cut.tests mode change 100755 => 100644 release/src/router/busybox/testsuite/cut/cut-cuts-a-character mode change 100755 => 100644 release/src/router/busybox/testsuite/cut/cut-cuts-a-closed-range mode change 100755 => 100644 release/src/router/busybox/testsuite/cut/cut-cuts-a-field mode change 100755 => 100644 release/src/router/busybox/testsuite/cut/cut-cuts-an-open-range mode change 100755 => 100644 release/src/router/busybox/testsuite/cut/cut-cuts-an-unclosed-range create mode 100644 release/src/router/busybox/testsuite/date/date-R-works create mode 100644 release/src/router/busybox/testsuite/date/date-format-works create mode 100644 release/src/router/busybox/testsuite/date/date-u-works create mode 100644 release/src/router/busybox/testsuite/date/date-works create mode 100644 release/src/router/busybox/testsuite/date/date-works-1 mode change 100755 => 100644 release/src/router/busybox/testsuite/dd/dd-accepts-if mode change 100755 => 100644 release/src/router/busybox/testsuite/dd/dd-accepts-of mode change 100755 => 100644 release/src/router/busybox/testsuite/dd/dd-copies-from-standard-input-to-standard-output mode change 100755 => 100644 release/src/router/busybox/testsuite/dd/dd-prints-count-to-standard-error create mode 100644 release/src/router/busybox/testsuite/dd/dd-reports-write-errors create mode 100755 release/src/router/busybox/testsuite/diff.tests mode change 100755 => 100644 release/src/router/busybox/testsuite/dirname/dirname-handles-absolute-path mode change 100755 => 100644 release/src/router/busybox/testsuite/dirname/dirname-handles-empty-path mode change 100755 => 100644 release/src/router/busybox/testsuite/dirname/dirname-handles-multiple-slashes mode change 100755 => 100644 release/src/router/busybox/testsuite/dirname/dirname-handles-relative-path mode change 100755 => 100644 release/src/router/busybox/testsuite/dirname/dirname-handles-root mode change 100755 => 100644 release/src/router/busybox/testsuite/dirname/dirname-handles-single-component create mode 100644 release/src/router/busybox/testsuite/dirname/dirname-works create mode 100644 release/src/router/busybox/testsuite/du/du-h-works create mode 100644 release/src/router/busybox/testsuite/du/du-k-works create mode 100644 release/src/router/busybox/testsuite/du/du-l-works create mode 100644 release/src/router/busybox/testsuite/du/du-m-works create mode 100644 release/src/router/busybox/testsuite/du/du-s-works create mode 100644 release/src/router/busybox/testsuite/du/du-works mode change 100755 => 100644 release/src/router/busybox/testsuite/echo/echo-does-not-print-newline mode change 100755 => 100644 release/src/router/busybox/testsuite/echo/echo-prints-argument mode change 100755 => 100644 release/src/router/busybox/testsuite/echo/echo-prints-arguments mode change 100755 => 100644 release/src/router/busybox/testsuite/echo/echo-prints-newline create mode 100644 release/src/router/busybox/testsuite/echo/echo-prints-slash-zero create mode 100755 release/src/router/busybox/testsuite/expand.tests create mode 100644 release/src/router/busybox/testsuite/expand/expand-works-like-GNU create mode 100644 release/src/router/busybox/testsuite/expr/expr-big create mode 100644 release/src/router/busybox/testsuite/expr/expr-works mode change 100755 => 100644 release/src/router/busybox/testsuite/false/false-is-silent mode change 100755 => 100644 release/src/router/busybox/testsuite/false/false-returns-failure mode change 100755 => 100644 release/src/router/busybox/testsuite/find/find-supports-minus-xdev create mode 100755 release/src/router/busybox/testsuite/grep.tests delete mode 100755 release/src/router/busybox/testsuite/grep/egrep-is-not-case-insensitive delete mode 100755 release/src/router/busybox/testsuite/grep/egrep-supports-extended-regexps delete mode 100755 release/src/router/busybox/testsuite/grep/grep-handles-binary-files delete mode 100755 release/src/router/busybox/testsuite/grep/grep-handles-multiple-regexps delete mode 100755 release/src/router/busybox/testsuite/grep/grep-is-also-egrep delete mode 100755 release/src/router/busybox/testsuite/grep/grep-matches-NUL create mode 100755 release/src/router/busybox/testsuite/gunzip.tests mode change 100755 => 100644 release/src/router/busybox/testsuite/gunzip/gunzip-reads-from-standard-input mode change 100755 => 100644 release/src/router/busybox/testsuite/gzip/gzip-accepts-multiple-files mode change 100755 => 100644 release/src/router/busybox/testsuite/gzip/gzip-accepts-single-minus mode change 100755 => 100644 release/src/router/busybox/testsuite/gzip/gzip-removes-original-file create mode 100644 release/src/router/busybox/testsuite/head/head-n-works create mode 100644 release/src/router/busybox/testsuite/head/head-works create mode 100644 release/src/router/busybox/testsuite/hostid/hostid-works create mode 100644 release/src/router/busybox/testsuite/hostname/hostname-d-works create mode 100644 release/src/router/busybox/testsuite/hostname/hostname-i-works create mode 100644 release/src/router/busybox/testsuite/hostname/hostname-s-works create mode 100644 release/src/router/busybox/testsuite/hostname/hostname-works create mode 100644 release/src/router/busybox/testsuite/id/id-g-works create mode 100644 release/src/router/busybox/testsuite/id/id-u-works create mode 100644 release/src/router/busybox/testsuite/id/id-un-works create mode 100644 release/src/router/busybox/testsuite/id/id-ur-works create mode 100644 release/src/router/busybox/testsuite/ln/ln-creates-hard-links create mode 100644 release/src/router/busybox/testsuite/ln/ln-creates-soft-links create mode 100644 release/src/router/busybox/testsuite/ln/ln-force-creates-hard-links create mode 100644 release/src/router/busybox/testsuite/ln/ln-force-creates-soft-links create mode 100644 release/src/router/busybox/testsuite/ln/ln-preserves-hard-links create mode 100644 release/src/router/busybox/testsuite/ln/ln-preserves-soft-links create mode 100644 release/src/router/busybox/testsuite/ls/ls-1-works create mode 100644 release/src/router/busybox/testsuite/ls/ls-h-works create mode 100644 release/src/router/busybox/testsuite/ls/ls-l-works create mode 100644 release/src/router/busybox/testsuite/ls/ls-s-works create mode 100644 release/src/router/busybox/testsuite/makedevs.device_table.txt create mode 100755 release/src/router/busybox/testsuite/makedevs.tests mode change 100755 => 100644 release/src/router/busybox/testsuite/md5sum/md5sum-verifies-non-binary-file create mode 100755 release/src/router/busybox/testsuite/mdev.tests mode change 100755 => 100644 release/src/router/busybox/testsuite/mkdir/mkdir-makes-a-directory mode change 100755 => 100644 release/src/router/busybox/testsuite/mkdir/mkdir-makes-parent-directories create mode 100755 release/src/router/busybox/testsuite/mkfs.minix.tests create mode 100755 release/src/router/busybox/testsuite/mount.testroot create mode 100755 release/src/router/busybox/testsuite/mount.tests mode change 100755 => 100644 release/src/router/busybox/testsuite/msh/msh-supports-underscores-in-variable-names create mode 100644 release/src/router/busybox/testsuite/mv/mv-files-to-dir create mode 100644 release/src/router/busybox/testsuite/mv/mv-follows-links create mode 100644 release/src/router/busybox/testsuite/mv/mv-moves-empty-file mode change 100755 => 100644 release/src/router/busybox/testsuite/mv/mv-moves-file create mode 100644 release/src/router/busybox/testsuite/mv/mv-moves-hardlinks create mode 100644 release/src/router/busybox/testsuite/mv/mv-moves-large-file create mode 100644 release/src/router/busybox/testsuite/mv/mv-moves-small-file create mode 100644 release/src/router/busybox/testsuite/mv/mv-moves-symlinks create mode 100644 release/src/router/busybox/testsuite/mv/mv-moves-unreadable-files create mode 100644 release/src/router/busybox/testsuite/mv/mv-preserves-hard-links create mode 100644 release/src/router/busybox/testsuite/mv/mv-preserves-links create mode 100644 release/src/router/busybox/testsuite/mv/mv-refuses-mv-dir-to-subdir create mode 100644 release/src/router/busybox/testsuite/mv/mv-removes-source-file create mode 100755 release/src/router/busybox/testsuite/od.tests create mode 100755 release/src/router/busybox/testsuite/parse.tests create mode 100755 release/src/router/busybox/testsuite/patch.tests create mode 100755 release/src/router/busybox/testsuite/pidof.tests create mode 100755 release/src/router/busybox/testsuite/printf.tests mode change 100755 => 100644 release/src/router/busybox/testsuite/pwd/pwd-prints-working-directory create mode 100755 release/src/router/busybox/testsuite/readlink.tests mode change 100755 => 100644 release/src/router/busybox/testsuite/rm/rm-removes-file mode change 100755 => 100644 release/src/router/busybox/testsuite/rmdir/rmdir-removes-parent-directories create mode 100755 release/src/router/busybox/testsuite/sed.tests delete mode 100755 release/src/router/busybox/testsuite/sed/sed-accepts-blanks-before-command delete mode 100755 release/src/router/busybox/testsuite/sed/sed-aic-commands delete mode 100755 release/src/router/busybox/testsuite/sed/sed-chains-substs delete mode 100755 release/src/router/busybox/testsuite/sed/sed-does-not-substitute-in-deleted-line delete mode 100755 release/src/router/busybox/testsuite/sed/sed-handles-embedded-slashes delete mode 100755 release/src/router/busybox/testsuite/sed/sed-handles-empty-lines delete mode 100755 release/src/router/busybox/testsuite/sed/sed-handles-unsatisfied-backrefs delete mode 100755 release/src/router/busybox/testsuite/sed/sed-prints-line-once-for-multiple-substs delete mode 100755 release/src/router/busybox/testsuite/sed/sed-recurses-properly delete mode 100755 release/src/router/busybox/testsuite/sed/sed-requires-newline-after-edit-command delete mode 100755 release/src/router/busybox/testsuite/sed/sed-splits-edit-commands-on-command-line create mode 100755 release/src/router/busybox/testsuite/seq.tests create mode 100755 release/src/router/busybox/testsuite/sort.tests create mode 100755 release/src/router/busybox/testsuite/start-stop-daemon.tests mode change 100755 => 100644 release/src/router/busybox/testsuite/strings/strings-works-like-GNU create mode 100755 release/src/router/busybox/testsuite/sum.tests create mode 100644 release/src/router/busybox/testsuite/tail/tail-n-works create mode 100644 release/src/router/busybox/testsuite/tail/tail-works mode change 100755 => 100644 release/src/router/busybox/testsuite/tar/tar-archives-multiple-files mode change 100755 => 100644 release/src/router/busybox/testsuite/tar/tar-complains-about-missing-file mode change 100755 => 100644 release/src/router/busybox/testsuite/tar/tar-demands-at-least-one-ctx mode change 100755 => 100644 release/src/router/busybox/testsuite/tar/tar-demands-at-most-one-ctx create mode 100644 release/src/router/busybox/testsuite/tar/tar-extracts-all-subdirs mode change 100755 => 100644 release/src/router/busybox/testsuite/tar/tar-extracts-file mode change 100755 => 100644 release/src/router/busybox/testsuite/tar/tar-extracts-from-standard-input mode change 100755 => 100644 release/src/router/busybox/testsuite/tar/tar-extracts-multiple-files mode change 100755 => 100644 release/src/router/busybox/testsuite/tar/tar-extracts-to-standard-output mode change 100755 => 100644 release/src/router/busybox/testsuite/tar/tar-handles-cz-options mode change 100755 => 100644 release/src/router/busybox/testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list mode change 100755 => 100644 release/src/router/busybox/testsuite/tar/tar-handles-exclude-and-extract-lists mode change 100755 => 100644 release/src/router/busybox/testsuite/tar/tar-handles-multiple-X-options mode change 100755 => 100644 release/src/router/busybox/testsuite/tar/tar-handles-nested-exclude create mode 100644 release/src/router/busybox/testsuite/tar/tar_with_link_with_size create mode 100644 release/src/router/busybox/testsuite/tar/tar_with_prefix_fields create mode 100755 release/src/router/busybox/testsuite/taskset.tests mode change 100755 => 100644 release/src/router/busybox/testsuite/tee/tee-appends-input mode change 100755 => 100644 release/src/router/busybox/testsuite/tee/tee-tees-input create mode 100755 release/src/router/busybox/testsuite/test.tests create mode 100755 release/src/router/busybox/testsuite/testing.sh mode change 100755 => 100644 release/src/router/busybox/testsuite/touch/touch-creates-file mode change 100755 => 100644 release/src/router/busybox/testsuite/touch/touch-does-not-create-file mode change 100755 => 100644 release/src/router/busybox/testsuite/touch/touch-touches-files-after-non-existent-file create mode 100644 release/src/router/busybox/testsuite/tr.tests create mode 100644 release/src/router/busybox/testsuite/tr/tr-d-alnum-works create mode 100644 release/src/router/busybox/testsuite/tr/tr-d-works create mode 100644 release/src/router/busybox/testsuite/tr/tr-non-gnu create mode 100644 release/src/router/busybox/testsuite/tr/tr-rejects-wrong-class create mode 100644 release/src/router/busybox/testsuite/tr/tr-works mode change 100755 => 100644 release/src/router/busybox/testsuite/true/true-is-silent mode change 100755 => 100644 release/src/router/busybox/testsuite/true/true-returns-success create mode 100755 release/src/router/busybox/testsuite/umlwrapper.sh create mode 100755 release/src/router/busybox/testsuite/unexpand.tests create mode 100644 release/src/router/busybox/testsuite/unexpand/unexpand-works-like-GNU create mode 100755 release/src/router/busybox/testsuite/uniq.tests create mode 100755 release/src/router/busybox/testsuite/unzip.tests create mode 100644 release/src/router/busybox/testsuite/uptime/uptime-works create mode 100755 release/src/router/busybox/testsuite/uuencode.tests delete mode 100755 release/src/router/busybox/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly mode change 100755 => 100644 release/src/router/busybox/testsuite/wc/wc-counts-all mode change 100755 => 100644 release/src/router/busybox/testsuite/wc/wc-counts-characters mode change 100755 => 100644 release/src/router/busybox/testsuite/wc/wc-counts-lines mode change 100755 => 100644 release/src/router/busybox/testsuite/wc/wc-counts-words mode change 100755 => 100644 release/src/router/busybox/testsuite/wc/wc-prints-longest-line-length mode change 100755 => 100644 release/src/router/busybox/testsuite/wget/wget--O-overrides--P mode change 100755 => 100644 release/src/router/busybox/testsuite/wget/wget-handles-empty-path mode change 100755 => 100644 release/src/router/busybox/testsuite/wget/wget-retrieves-google-index mode change 100755 => 100644 release/src/router/busybox/testsuite/wget/wget-supports--P mode change 100755 => 100644 release/src/router/busybox/testsuite/which/which-uses-default-path create mode 100755 release/src/router/busybox/testsuite/xargs.tests create mode 100644 release/src/router/busybox/testsuite/xargs/xargs-works (limited to 'release/src/router/busybox/testsuite') diff --git a/release/src/router/busybox/testsuite/README b/release/src/router/busybox/testsuite/README index 40439bfe..b4719e64 100644 --- a/release/src/router/busybox/testsuite/README +++ b/release/src/router/busybox/testsuite/README @@ -1,7 +1,9 @@ To run the test suite, change to this directory and run "./runtest". It will run all of the test cases, and list those with unexpected outcomes. Adding the -v option will cause it to show expected outcomes as well. To only run the test -cases for particular applets, specify them as parameters to runtest. +cases for particular applets: + +./runtest ... The test cases for an applet reside in the subdirectory of the applet name. The name of the test case should be the assertion that is tested. The test case diff --git a/release/src/router/busybox/testsuite/TODO b/release/src/router/busybox/testsuite/TODO old mode 100755 new mode 100644 index ced57159..b8957f48 --- a/release/src/router/busybox/testsuite/TODO +++ b/release/src/router/busybox/testsuite/TODO @@ -2,17 +2,25 @@ This testsuite is quite obviously a work in progress. As such, there are a number of good extensions. If you are looking for something to do, feel free to tackle one or more of the following: -Buildroot support - Erik has put together a handy package for constructing and - testing busybox called buildroot. Integrating this into - the testsuite would allow for greater test coverage (e.g., - init, mount, and other privileged applications). +Moving to the new format. + The old way was "lots of little tests files in a directory", which + doesn't interact well with source control systems. The new test + format is command.tests files that use testing.sh. + +Every busybox applet needs a corresponding applet.tests. + +Full SUSv3 test suite. + Let's make the Linux Test Project jealous, shall we? Don't just + audit programs for standards compliance, _prove_ it with a regression + test harness. + + http://www.opengroup.org/onlinepubs/009695399/utilities/ + +Some tests need root access. + It's hard to test things like mount or init as a normal user. + Possibly User Mode Linux could be used for this, or perhaps + Erik's buildroot. libbb unit testing Being able to test the functions of libbb individually may help to prevent regressions. - -Standardization - This testsuite is totally bastardized. It would be better - to use an existing test framework, such as dejagnu, greg, - or a XUnit clone (shunit?). diff --git a/release/src/router/busybox/testsuite/all_sourcecode.tests b/release/src/router/busybox/testsuite/all_sourcecode.tests new file mode 100755 index 00000000..45f40112 --- /dev/null +++ b/release/src/router/busybox/testsuite/all_sourcecode.tests @@ -0,0 +1,92 @@ +#!/bin/sh + +# Tests for the sourcecode base itself. +# Copyright 2006 by Mike Frysinger +# Licensed under GPL v2, see file LICENSE for details. + +[ -n "$srcdir" ] || srcdir=$(pwd) +. testing.sh + + +# +# if we don't have the sourcecode available, let's just bail +# +[ -s "$srcdir/../Makefile" ] || exit 0 +[ -s "$srcdir/../include/applets.h" ] || exit 0 + + +# +# make sure all usage strings are properly escaped. oftentimes people miss +# an escape sequence so we end up with: +# #define foo_usage \ +# " this line is ok" \ +# " as is this line" +# " but this one is broken as the \ is missing from above" +# +${CROSS_COMPILE}cpp -dD -P $srcdir/../include/usage.h \ + | sed -e '/^#define/d' -e '/^$/d' > src.usage.escaped +testing "Usage strings escaped" "cat src.usage.escaped" "" "" "" +rm -f src.usage.escaped + + +# +# verify the applet order is correct in applets.h, otherwise +# applets won't be called properly. +# +sed -n -e '/^USE_[A-Z]*(APPLET/{s:,.*::;s:.*(::;s:"::g;p}' \ + $srcdir/../include/applets.h > applet.order.current +LC_ALL=C sort applet.order.current > applet.order.correct +testing "Applet order" "diff -u applet.order.current applet.order.correct" "" "" "" +rm -f applet.order.current applet.order.correct + + +# +# check for misc common typos +# +find $srcdir/../ \ + '(' -type d -a '(' -name .svn -o -name testsuite ')' -prune ')' \ + -o '(' -type f -a -print0 ')' | xargs -0 \ + grep -I \ + -e '\' \ + -e '\' \ + -e '\' \ + -e '\' -e '\' -e '\' \ + -e '\' \ + -e '\' \ + -e '\' \ + -e '\' \ + -e '\' \ + -e '\' \ + -e '\' \ + -e '\' \ + -e '\' \ + -e '\' \ + -e '\' \ + -e '\' \ + -e '\' \ + | sed -e "s:^$srcdir/\.\./::g" > src.typos +testing "Common typos" "cat src.typos" "" "" "" +rm -f src.typos + + +# +# don't allow obsolete functions +# +find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \ + grep -E -e '\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utimes|sigblock|siggetmask|sigsetmask)\>[[:space:]]*\(' \ + | sed -e "s:^$srcdir/\.\./::g" > src.obsolete.funcs +testing "Obsolete function usage" "cat src.obsolete.funcs" "" "" "" +rm -f src.obsolete.funcs + + +# +# don't allow obsolete headers +# +find $srcdir/.. '(' -name '*.c' -o -name '*.h' ')' -print0 | xargs -0 \ + grep -E -e '\<(malloc|memory|sys/(errno|fcntl|signal|stropts|termios|unistd))\.h\>' \ + | sed -e "s:^$srcdir/\.\./::g" > src.obsolete.headers +testing "Obsolete headers" "cat src.obsolete.headers" "" "" "" +rm -f src.obsolete.headers + + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/awk.tests b/release/src/router/busybox/testsuite/awk.tests new file mode 100755 index 00000000..0db99ab2 --- /dev/null +++ b/release/src/router/busybox/testsuite/awk.tests @@ -0,0 +1,50 @@ +#!/bin/sh + +# Copyright 2007 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# testing "description" "command" "result" "infile" "stdin" + +testing "awk -F case 0" "awk -F '[#]' '{ print NF }'" "" "" "" +testing "awk -F case 1" "awk -F '[#]' '{ print NF }'" "0\n" "" "\n" +testing "awk -F case 2" "awk -F '[#]' '{ print NF }'" "2\n" "" "#\n" +testing "awk -F case 3" "awk -F '[#]' '{ print NF }'" "3\n" "" "#abc#\n" +testing "awk -F case 4" "awk -F '[#]' '{ print NF }'" "3\n" "" "#abc#zz\n" +testing "awk -F case 5" "awk -F '[#]' '{ print NF }'" "4\n" "" "#abc##zz\n" +testing "awk -F case 6" "awk -F '[#]' '{ print NF }'" "4\n" "" "z#abc##zz\n" +testing "awk -F case 7" "awk -F '[#]' '{ print NF }'" "5\n" "" "z##abc##zz\n" + +# 4294967295 = 0xffffffff +testing "awk bitwise op" "awk '{ print or(4294967295,1) }'" "4.29497e+09\n" "" "\n" +testing "awk hex const 1" "awk '{ print or(0xffffffff,1) }'" "4.29497e+09\n" "" "\n" +testing "awk hex const 2" "awk '{ print or(0x80000000,1) }'" "2.14748e+09\n" "" "\n" +testing "awk oct const" "awk '{ print or(01234,1) }'" "669\n" "" "\n" + +# long field seps requiring regex +testing "awk long field sep" "awk -F-- '{ print NF, length(\$NF), \$NF }'" \ + "2 0 \n3 0 \n4 0 \n5 0 \n" \ + "" \ + "a--\na--b--\na--b--c--\na--b--c--d--" + +# '@(samp|code|file)\{' is an invalid extended regex (unmatched '{'), +# but gawk 3.1.5 does not bail out on it. +testing "awk gsub falls back to non-extended-regex" \ + "awk 'gsub(\"@(samp|code|file)\{\",\"\");'; echo \$?" "0\n" "" "Hi\n" + +tar xjf awk_t1.tar.bz2 +testing "awk 'gcc build bug'" \ + "awk -f awk_t1_opt-functions.awk -f awk_t1_opth-gen.awk t1.$ext + hello_$ext >t2.$ext +} + +check() { + eval $2 >t_actual 2>&1 + if $ECHO -ne "$expected" | cmp - t_actual; then + echo "$1: PASS" + else + echo "$1: FAIL" + fi +} + +mkdir testdir 2>/dev/null +( +cd testdir || { echo "cannot cd testdir!"; exit 1; } + +expected="$unpack: z: No such file or directory +1 +HELLO +" +prep; check "$unpack: doesnt exist" "${bb}$unpack z t1.$ext; echo \$?; cat t1" + + +expected="$unpack: t.zz: unknown suffix - ignored +1 +HELLO +" +prep; >t.zz; check "$unpack: unknown suffix" "${bb}$unpack t.zz t1.$ext; echo \$?; cat t1" + + +# In this case file "t1" exists, and we skip t1.gz and unpack t2.gz +expected="$unpack: can't open 't1': File exists +1 +HELLO +" +prep; >t1; check "$unpack: already exists" "${bb}$unpack t1.$ext t2.$ext; echo \$?; cat t1 t2" + + +# From old testsuite +expected="HELLO\n0\n" +prep; check "$unpack: stream unpack" "cat t1.$ext | ${bb}$unpack; echo $?" + +expected="ok\n" +prep; check "$unpack: delete src" "${bb}$unpack t2.$ext; test ! -f t2.$ext && echo ok" + +) +rm -rf testdir + +# This test is only for bunzip2 +if test "${0##*/}" = "bunzip2.tests"; then + if test1_bz2 | ${bb}bunzip2 >/dev/null \ + && test "`test1_bz2 | ${bb}bunzip2 | md5sum`" = "61bbeee4be9c6f110a71447f584fda7b -" + then + echo "$unpack: test bz2 file: PASS" + else + echo "$unpack: test bz2 file: FAIL" + fi +fi diff --git a/release/src/router/busybox/testsuite/bunzip2/bunzip2-reads-from-standard-input b/release/src/router/busybox/testsuite/bunzip2/bunzip2-reads-from-standard-input old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/bunzip2/bunzip2-removes-compressed-file b/release/src/router/busybox/testsuite/bunzip2/bunzip2-removes-compressed-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/bunzip2/bzcat-does-not-remove-compressed-file b/release/src/router/busybox/testsuite/bunzip2/bzcat-does-not-remove-compressed-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/busybox.tests b/release/src/router/busybox/testsuite/busybox.tests new file mode 100755 index 00000000..26536c65 --- /dev/null +++ b/release/src/router/busybox/testsuite/busybox.tests @@ -0,0 +1,46 @@ +#!/bin/sh + +# Tests for busybox applet itself. +# Copyright 2005 by Rob Landley +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +HELPDUMP=`busybox` + +# We need to test under calling the binary under other names. + + +testing "busybox --help busybox" "busybox --help busybox" "$HELPDUMP\n\n" "" "" + +ln -s `which busybox` busybox-suffix +for i in busybox ./busybox-suffix +do + # The gratuitous "\n"s are due to a shell idiosyncrasy: + # environment variables seem to strip trailing whitespace. + + testing "" "$i" "$HELPDUMP\n\n" "" "" + + testing "$i unknown" "$i unknown 2>&1" \ + "unknown: applet not found\n" "" "" + + testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" "" + + optional CAT + testing "" "$i cat" "moo" "" "moo" + testing "$i --help cat" "$i --help cat 2>&1 | grep prints" \ + "Concatenates FILE(s) and prints them to stdout.\n" "" "" + optional "" + + testing "$i --help unknown" "$i --help unknown 2>&1" \ + "unknown: applet not found\n" "" "" +done +rm busybox-suffix + +ln -s `which busybox` unknown + +testing "busybox as unknown name" "./unknown 2>&1" \ + "unknown: applet not found\n" "" "" +rm unknown + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/bzcat.tests b/release/src/router/busybox/testsuite/bzcat.tests new file mode 100755 index 00000000..0bc74424 --- /dev/null +++ b/release/src/router/busybox/testsuite/bzcat.tests @@ -0,0 +1,49 @@ +#!/bin/sh + +ext=bz2 + +bb="busybox " + +unset LC_ALL +unset LC_MESSAGES +unset LANG +unset LANGUAGE + +hello_gz() { + # Gzipped "HELLO\n" + #_________________________ vvv vvv vvv vvv - mtime + $ECHO -ne "\x1f\x8b\x08\x00\x85\x1d\xef\x45\x02\x03\xf3\x70\xf5\xf1\xf1\xe7" + $ECHO -ne "\x02\x00\x6e\xd7\xac\xfd\x06\x00\x00\x00" +} + +hello_bz2() { + # Bzipped "HELLO\n" + $ECHO -ne "\x42\x5a\x68\x39\x31\x41\x59\x26\x53\x59\x5b\xb8\xe8\xa3\x00\x00" + $ECHO -ne "\x01\x44\x00\x00\x10\x02\x44\xa0\x00\x30\xcd\x00\xc3\x46\x29\x97" + $ECHO -ne "\x17\x72\x45\x38\x50\x90\x5b\xb8\xe8\xa3" +} + +prep() { + rm -f t* + hello_$ext >t1.$ext + hello_$ext >t2.$ext +} + +check() { + eval $2 >t_actual 2>&1 + if $ECHO -ne "$expected" | cmp - t_actual; then + echo "$1: PASS" + else + echo "$1: FAIL" + fi +} + +mkdir testdir 2>/dev/null +( +cd testdir || { echo "cannot cd testdir!"; exit 1; } + +expected="HELLO\nok\n" +prep; check "bzcat: dont delete src" "${bb}bzcat t2.bz2; test -f t2.bz2 && echo ok" + +) +rm -rf testdir diff --git a/release/src/router/busybox/testsuite/cat/cat-prints-a-file b/release/src/router/busybox/testsuite/cat/cat-prints-a-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/cat/cat-prints-a-file-and-standard-input b/release/src/router/busybox/testsuite/cat/cat-prints-a-file-and-standard-input old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/cmp/cmp-detects-difference b/release/src/router/busybox/testsuite/cmp/cmp-detects-difference old mode 100755 new mode 100644 index aa074448..b9bb628f --- a/release/src/router/busybox/testsuite/cmp/cmp-detects-difference +++ b/release/src/router/busybox/testsuite/cmp/cmp-detects-difference @@ -1,3 +1,9 @@ echo foo >foo echo bar >bar -! busybox cmp -s foo bar +set +e +busybox cmp -s foo bar +if [ $? != 0 ] ; then + exit 0; +fi + +exit 1; diff --git a/release/src/router/busybox/testsuite/comm.tests b/release/src/router/busybox/testsuite/comm.tests new file mode 100755 index 00000000..44169f9b --- /dev/null +++ b/release/src/router/busybox/testsuite/comm.tests @@ -0,0 +1,19 @@ +#!/bin/sh + +# Copyright 2008 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# testing "description" "command" "result" "infile" "stdin" + +testing "comm test 1" "comm input -" "\t123\n""456\n""abc\n""\tdef\n" "456\nabc\n" "123\ndef\n" +testing "comm test 2" "comm - input" "123\n""\t456\n""\tabc\n""def\n" "456\nabc\n" "123\ndef\n" +testing "comm test 3" "comm input -" "abc\n""\tdef\n""xyz\n" "abc\nxyz\n" "def\n" +testing "comm test 4" "comm - input" "\tabc\n""def\n""\txyz\n" "abc\nxyz\n" "def\n" +testing "comm test 5" "comm input -" "123\n""abc\n""\tdef\n" "123\nabc\n" "def\n" +testing "comm test 6" "comm - input" "\t123\n""\tabc\n""def\n" "123\nabc\n" "def\n" +testing "comm unterminated line 1" "comm input -" "abc\n""\tdef\n" "abc" "def" +testing "comm unterminated line 2" "comm - input" "\tabc\n""def\n" "abc" "def" + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/cp/cp-RHL-does_not_preserve-links b/release/src/router/busybox/testsuite/cp/cp-RHL-does_not_preserve-links new file mode 100644 index 00000000..eed6c3ec --- /dev/null +++ b/release/src/router/busybox/testsuite/cp/cp-RHL-does_not_preserve-links @@ -0,0 +1,6 @@ +mkdir a +>a/file +ln -s file a/link +busybox cp -RHL a b +test ! -L b/link +#sh /dev/tty 2>&1 diff --git a/release/src/router/busybox/testsuite/cp/cp-a-files-to-dir b/release/src/router/busybox/testsuite/cp/cp-a-files-to-dir new file mode 100644 index 00000000..abdbdf77 --- /dev/null +++ b/release/src/router/busybox/testsuite/cp/cp-a-files-to-dir @@ -0,0 +1,15 @@ +echo file number one > file1 +echo file number two > file2 +ln -s file2 link1 +mkdir dir1 +# why??? +#touch --date='Sat Jan 29 21:24:08 PST 2000' dir1/file3 +mkdir there +busybox cp -a file1 file2 link1 dir1 there +test -f there/file1 +test -f there/file2 +test ! -s there/dir1/file3 +test -L there/link1 +test xfile2 = x`readlink there/link1` +test ! dir1/file3 -ot there/dir1/file3 +test ! dir1/file3 -nt there/dir1/file3 diff --git a/release/src/router/busybox/testsuite/cp/cp-a-preserves-links b/release/src/router/busybox/testsuite/cp/cp-a-preserves-links new file mode 100644 index 00000000..0c0cd965 --- /dev/null +++ b/release/src/router/busybox/testsuite/cp/cp-a-preserves-links @@ -0,0 +1,5 @@ +touch foo +ln -s foo bar +busybox cp -a bar baz +test -L baz +test xfoo = x`readlink baz` diff --git a/release/src/router/busybox/testsuite/cp/cp-copies-empty-file b/release/src/router/busybox/testsuite/cp/cp-copies-empty-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/cp/cp-copies-large-file b/release/src/router/busybox/testsuite/cp/cp-copies-large-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/cp/cp-copies-small-file b/release/src/router/busybox/testsuite/cp/cp-copies-small-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/cp/cp-d-files-to-dir b/release/src/router/busybox/testsuite/cp/cp-d-files-to-dir new file mode 100644 index 00000000..9571a567 --- /dev/null +++ b/release/src/router/busybox/testsuite/cp/cp-d-files-to-dir @@ -0,0 +1,11 @@ +echo file number one > file1 +echo file number two > file2 +touch file3 +ln -s file2 link1 +mkdir there +busybox cp -d file1 file2 file3 link1 there +test -f there/file1 +test -f there/file2 +test ! -s there/file3 +test -L there/link1 +test xfile2 = x`readlink there/link1` diff --git a/release/src/router/busybox/testsuite/cp/cp-dev-file b/release/src/router/busybox/testsuite/cp/cp-dev-file new file mode 100644 index 00000000..055f0d9e --- /dev/null +++ b/release/src/router/busybox/testsuite/cp/cp-dev-file @@ -0,0 +1,2 @@ +busybox cp /dev/null foo +test -f foo diff --git a/release/src/router/busybox/testsuite/cp/cp-dir-create-dir b/release/src/router/busybox/testsuite/cp/cp-dir-create-dir new file mode 100644 index 00000000..a8d7b50a --- /dev/null +++ b/release/src/router/busybox/testsuite/cp/cp-dir-create-dir @@ -0,0 +1,4 @@ +mkdir bar +touch bar/baz +busybox cp -R bar foo +test -f foo/baz diff --git a/release/src/router/busybox/testsuite/cp/cp-dir-existing-dir b/release/src/router/busybox/testsuite/cp/cp-dir-existing-dir new file mode 100644 index 00000000..4c788ba7 --- /dev/null +++ b/release/src/router/busybox/testsuite/cp/cp-dir-existing-dir @@ -0,0 +1,5 @@ +mkdir bar +touch bar/baz +mkdir foo +busybox cp -R bar foo +test -f foo/bar/baz diff --git a/release/src/router/busybox/testsuite/cp/cp-does-not-copy-unreadable-file b/release/src/router/busybox/testsuite/cp/cp-does-not-copy-unreadable-file old mode 100755 new mode 100644 index 68c57672..e17e8e66 --- a/release/src/router/busybox/testsuite/cp/cp-does-not-copy-unreadable-file +++ b/release/src/router/busybox/testsuite/cp/cp-does-not-copy-unreadable-file @@ -1,4 +1,11 @@ touch foo chmod a-r foo -busybox cp foo bar +set +e +if test `id -u` = 0; then + # run as user with nonzero uid + setuidgid 1 busybox cp foo bar +else + busybox cp foo bar +fi +set -e test ! -f bar diff --git a/release/src/router/busybox/testsuite/cp/cp-files-to-dir b/release/src/router/busybox/testsuite/cp/cp-files-to-dir new file mode 100644 index 00000000..fdb81916 --- /dev/null +++ b/release/src/router/busybox/testsuite/cp/cp-files-to-dir @@ -0,0 +1,11 @@ +echo file number one > file1 +echo file number two > file2 +touch file3 +ln -s file2 link1 +mkdir there +busybox cp file1 file2 file3 link1 there +test -f there/file1 +test -f there/file2 +test ! -s there/file3 +test -f there/link1 +cmp there/file2 there/link1 diff --git a/release/src/router/busybox/testsuite/cp/cp-follows-links b/release/src/router/busybox/testsuite/cp/cp-follows-links old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/cp/cp-preserves-hard-links b/release/src/router/busybox/testsuite/cp/cp-preserves-hard-links old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/cp/cp-preserves-links b/release/src/router/busybox/testsuite/cp/cp-preserves-links old mode 100755 new mode 100644 index a5269e8d..301dc5fd --- a/release/src/router/busybox/testsuite/cp/cp-preserves-links +++ b/release/src/router/busybox/testsuite/cp/cp-preserves-links @@ -2,3 +2,4 @@ touch foo ln -s foo bar busybox cp -d bar baz test -L baz +test xfoo = x`readlink baz` diff --git a/release/src/router/busybox/testsuite/cp/cp-preserves-source-file b/release/src/router/busybox/testsuite/cp/cp-preserves-source-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/cpio.tests b/release/src/router/busybox/testsuite/cpio.tests new file mode 100755 index 00000000..eb3e5764 --- /dev/null +++ b/release/src/router/busybox/testsuite/cpio.tests @@ -0,0 +1,83 @@ +#!/bin/sh +# Copyright 2008 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# ls -ln shows date. Need to remove that, it's variable. +# sed: coalesce spaces +# cut: remove date +FILTER_LS="sed 's/ */ /g' | cut -d' ' -f 1-5,9-" + + +# newc cpio archive of directory cpio.testdir with empty x and y hardlinks +hexdump="\ +\x42\x5a\x68\x39\x31\x41\x59\x26\x53\x59\x64\x1e\x91\x8c\x00\x00\ +\x48\x7f\x80\x4c\x48\x08\x00\x28\x01\xff\xe0\x3f\x24\x14\x00\x0e\ +\x20\xdc\x60\x20\x00\x92\x11\xea\xa0\x1a\x00\x00\x00\x03\x20\x8a\ +\x93\xd4\x9a\x68\x1a\x0d\x1e\x91\xa1\xa0\x06\x98\xe3\x5c\x2f\xd9\ +\x26\xa1\x25\x24\x20\xed\x47\xc7\x21\x40\x2b\x6e\xf2\xe6\xfe\x98\ +\x13\x68\xa8\xbd\x82\xb2\x4f\x26\x02\x24\x16\x5b\x22\x16\x72\x74\ +\x15\xcd\xc1\xa6\x9e\xa6\x5e\x6c\x16\x37\x35\x01\x99\xc4\x81\x21\ +\x29\x28\x4b\x69\x51\xa9\x3c\x1a\x9b\x0a\xe1\xe4\xb4\xaf\x85\x73\ +\xba\x23\x10\x59\xe8\xb3\xe1\xa1\x63\x05\x8c\x4f\xc5\xdc\x91\x4e\ +\x14\x24\x19\x07\xa4\x63\x00" + +user=$(id -u) +group=$(id -g) + +rm -rf cpio.testdir cpio.testdir2 2>/dev/null + +# testing "test name" "command" "expected result" "file input" "stdin" + +testing "cpio extracts zero-sized hardlinks" \ +"$ECHO -ne '$hexdump' | bzcat | cpio -i; echo \$?; +ls -ln cpio.testdir | $FILTER_LS" \ +"\ +1 blocks +0 +-rw-r--r-- 2 $user $group 0 x +-rw-r--r-- 2 $user $group 0 y +" \ + "" "" + +# Currently fails. Numerous: "1 blocks" versus "1 block", +# "1 block" must go to stderr, does not list cpio.testdir/x and cpio.testdir/y +testing "cpio lists hardlinks" \ +"$ECHO -ne '$hexdump' | bzcat | cpio -t 2>&1; echo \$?" \ +"\ +1 block +cpio.testdir +cpio.testdir/x +cpio.testdir/y +0 +" \ + "" "" + +# More complex case +rm -rf cpio.testdir cpio.testdir2 2>/dev/null +mkdir cpio.testdir +touch cpio.testdir/solo +touch cpio.testdir/empty +echo x >cpio.testdir/nonempty +ln cpio.testdir/empty cpio.testdir/empty1 +ln cpio.testdir/nonempty cpio.testdir/nonempty1 +mkdir cpio.testdir2 + +testing "cpio extracts zero-sized hardlinks 2" \ +"find cpio.testdir | cpio -H newc --create | (cd cpio.testdir2 && cpio -i); echo \$?; +ls -ln cpio.testdir2/cpio.testdir | $FILTER_LS" \ +"\ +0 +-rw-r--r-- 2 $user $group 0 empty +-rw-r--r-- 2 $user $group 0 empty1 +-rw-r--r-- 2 $user $group 2 nonempty +-rw-r--r-- 2 $user $group 2 nonempty1 +-rw-r--r-- 1 $user $group 0 solo +" \ + "" "" + +# Clean up +rm -rf cpio.testdir cpio.testdir2 2>/dev/null + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/cut.tests b/release/src/router/busybox/testsuite/cut.tests new file mode 100755 index 00000000..2788d1fb --- /dev/null +++ b/release/src/router/busybox/testsuite/cut.tests @@ -0,0 +1,18 @@ +#!/bin/sh + +# Copyright 2007 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# testing "test name" "options" "expected result" "file input" "stdin" +# file input will be file called "input" +# test can create a file "actual" instead of writing to stdout + +testing "cut '-' (stdin) and multi file handling" \ + "cut -d' ' -f2 - input" \ + "over\n""quick\n" \ + "the quick brown fox\n" \ + "jumps over the lazy dog\n" \ + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/cut/cut-cuts-a-character b/release/src/router/busybox/testsuite/cut/cut-cuts-a-character old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/cut/cut-cuts-a-closed-range b/release/src/router/busybox/testsuite/cut/cut-cuts-a-closed-range old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/cut/cut-cuts-a-field b/release/src/router/busybox/testsuite/cut/cut-cuts-a-field old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/cut/cut-cuts-an-open-range b/release/src/router/busybox/testsuite/cut/cut-cuts-an-open-range old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/cut/cut-cuts-an-unclosed-range b/release/src/router/busybox/testsuite/cut/cut-cuts-an-unclosed-range old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/date/date-R-works b/release/src/router/busybox/testsuite/date/date-R-works new file mode 100644 index 00000000..34cd735e --- /dev/null +++ b/release/src/router/busybox/testsuite/date/date-R-works @@ -0,0 +1 @@ +test x"`date -R`" = x"`busybox date -R`" diff --git a/release/src/router/busybox/testsuite/date/date-format-works b/release/src/router/busybox/testsuite/date/date-format-works new file mode 100644 index 00000000..f2a2091c --- /dev/null +++ b/release/src/router/busybox/testsuite/date/date-format-works @@ -0,0 +1,4 @@ +# TODO: gnu date doesn't accept '2000.11.22-11:22:33' format, +# but accepts '2000-11-22 11:22:33'. We must follow. +test x"01/01/99" = x"`busybox date -d 1999.01.01-11:22:33 '+%d/%m/%y'`" +test x"22/11/00" = x"`busybox date -d 2000.11.22-11:22:33 '+%d/%m/%y'`" diff --git a/release/src/router/busybox/testsuite/date/date-u-works b/release/src/router/busybox/testsuite/date/date-u-works new file mode 100644 index 00000000..eea6e5ae --- /dev/null +++ b/release/src/router/busybox/testsuite/date/date-u-works @@ -0,0 +1 @@ +test x"Sat Jan 1 11:22:33 UTC 2000" = x"`TZ=CET-1CEST-2 busybox date -u -d 2000.01.01-11:22:33`" diff --git a/release/src/router/busybox/testsuite/date/date-works b/release/src/router/busybox/testsuite/date/date-works new file mode 100644 index 00000000..0802e887 --- /dev/null +++ b/release/src/router/busybox/testsuite/date/date-works @@ -0,0 +1,44 @@ +dt=`busybox date` +# Expected format: Fri Apr 25 03:47:55 CEST 2008 +dt=`echo "$dt" | sed 's/^[^ ][^ ][^ ] [^ ][^ ][^ ] [ 0123][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9] [A-Z][A-Z]* [012][0-9][0-9][0-9]$/OK/'` +test x"$dt" = x"OK" + +dt=`busybox date -d 1:2` +dt=`echo "$dt" | cut -b12-19` +test x"$dt" = x"01:02:00" + +dt=`busybox date -d 1:2:3` +dt=`echo "$dt" | cut -b12-19` +test x"$dt" = x"01:02:03" + +dt=`busybox date -d 1.2-3:4` +dt=`echo "$dt" | cut -b5-19` +test x"$dt" = x"Jan 2 03:04:00" + +dt=`busybox date -d 1.2-3:4:5` +dt=`echo "$dt" | cut -b5-19` +test x"$dt" = x"Jan 2 03:04:05" + +dt=`busybox date -d 1999.1.2-3:4` +dt=`echo "$dt" | cut -b1-19` +test x"$dt" = x"Sat Jan 2 03:04:00" + +dt=`busybox date -d 1999.1.2-3:4:5` +dt=`echo "$dt" | cut -b1-19` +test x"$dt" = x"Sat Jan 2 03:04:05" + +dt=`busybox date -d '1999-1-2 3:4:5'` +dt=`echo "$dt" | cut -b1-19` +test x"$dt" = x"Sat Jan 2 03:04:05" + +dt=`busybox date -d 01231133` +dt=`echo "$dt" | cut -b5-19` +test x"$dt" = x"Jan 23 11:33:00" + +dt=`busybox date -d 012311332000` +dt=`echo "$dt" | cut -b1-19` +test x"$dt" = x"Sun Jan 23 11:33:00" + +dt=`busybox date -d 012311332000.30` +dt=`echo "$dt" | cut -b1-19` +test x"$dt" = x"Sun Jan 23 11:33:30" diff --git a/release/src/router/busybox/testsuite/date/date-works-1 b/release/src/router/busybox/testsuite/date/date-works-1 new file mode 100644 index 00000000..e318944d --- /dev/null +++ b/release/src/router/busybox/testsuite/date/date-works-1 @@ -0,0 +1,129 @@ +dt=`busybox date -d 1:2 +%T` +test x"$dt" = x"01:02:00" + +dt=`busybox date -d 1:2:3 +%T` +test x"$dt" = x"01:02:03" + +host_date=/bin/date + +# date (GNU coreutils) 6.10 reports: +# date: invalid date '1.2-3:4' +# busybox 1.11.0.svn date reports: +# date: invalid date '1/2 3:4' + +# TODO: (1) compare with strings, not "host date" +# (2) implement d/m[/y] hh:mm[:ss] fmt in date applet +#hdt=`$host_date -d '1/2 3:4'` +#dt=`busybox date -d 1.2-3:4` +#test x"$hdt" = x"$dt" + +#hdt=`$host_date -d '1/2 3:4:5'` +#dt=`busybox date -d 1.2-3:4:5` +#test x"$hdt" = x"$dt" + +#hdt=`$host_date -d '1/2/1999 3:4'` +#dt=`busybox date -d 1999.1.2-3:4` +#test x"$hdt" = x"$dt" + +#hdt=`$host_date -d '1/2/1999 3:4:5'` +#dt=`busybox date -d 1999.1.2-3:4:5` +#test x"$hdt" = x"$dt" + +hdt=`$host_date -d '1999-1-2 3:4:5'` +dt=`busybox date -d '1999-1-2 3:4:5'` +test x"$hdt" = x"$dt" + +# Avoiding using week day in this evaluation, as it's mostly different every year +# date (GNU coreutils) 6.10 reports: +# date: invalid date '01231133' +dt=`busybox date -d 01231133 +%c` +dt=`echo "$dt" | cut -b5-19` +test x"$dt" = x"Jan 23 11:33:00" + +# date (GNU coreutils) 6.10 reports: +# date: invalid date '012311332000' +dt=`busybox date -d 012311332000 +%c` +test x"$dt" = x"Sun Jan 23 11:33:00 2000" + +# date (GNU coreutils) 6.10 reports: +# date: invalid date '012311332000' +dt=`busybox date -d 012311332000.30 +%c` +test x"$dt" = x"Sun Jan 23 11:33:30 2000" + +lcbbd="LC_ALL=C busybox date" +wd=$(eval $lcbbd +%a) # weekday name +mn=$(eval $lcbbd +%b) # month name +dm=$(eval $lcbbd +%e) # day of month, space padded +h=$(eval $lcbbd +%H) # hour, zero padded +m=$(eval $lcbbd +%M) # minute, zero padded +s=$(eval $lcbbd +%S) # second, zero padded +z=$(eval $lcbbd -u +%Z) # time zone abbreviation +y=$(eval $lcbbd +%Y) # year + +res=OK +case $wd in + Sun) + ;; + Mon) + ;; + Tue) + ;; + Wed) + ;; + Thu) + ;; + Fri) + ;; + Sat) + ;; + *) + res=BAD + ;; +esac + +case $mn in + Jan) + ;; + Feb) + ;; + Mar) + ;; + Apr) + ;; + May) + ;; + Jun) + ;; + Jul) + ;; + Aug) + ;; + Sep) + ;; + Oct) + ;; + Nov) + ;; + Dec) + ;; + *) + res=BAD + ;; +esac + +dm=${dm# *} +[ $dm -ge 1 ] && [ $dm -le 31 ] || res=BAD +h=${h#0} +[ $h -ge 0 ] && [ $h -le 23 ] || res=BAD +m=${m#0} +[ $m -ge 0 ] && [ $m -le 59 ] || res=BAD +s=${s#0} +[ $s -ge 0 ] && [ $s -le 59 ] || res=BAD +[ $z = UTC ] || res=BAD +[ $y -ge 1970 ] || res=BAD + +test x"$res" = xOK + +# This should error out (by showing usage text). Testing for that +dt=`busybox date -d 012311332000.30 %+c 2>&1 | head -n 1` +test x"${dt#BusyBox * multi-call binary}" = x diff --git a/release/src/router/busybox/testsuite/dd/dd-accepts-if b/release/src/router/busybox/testsuite/dd/dd-accepts-if old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/dd/dd-accepts-of b/release/src/router/busybox/testsuite/dd/dd-accepts-of old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/dd/dd-copies-from-standard-input-to-standard-output b/release/src/router/busybox/testsuite/dd/dd-copies-from-standard-input-to-standard-output old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/dd/dd-prints-count-to-standard-error b/release/src/router/busybox/testsuite/dd/dd-prints-count-to-standard-error old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/dd/dd-reports-write-errors b/release/src/router/busybox/testsuite/dd/dd-reports-write-errors new file mode 100644 index 00000000..49206007 --- /dev/null +++ b/release/src/router/busybox/testsuite/dd/dd-reports-write-errors @@ -0,0 +1,2 @@ +busybox dd if="$0" of=/dev/full 2>/dev/null || status=$? +test $status = 1 diff --git a/release/src/router/busybox/testsuite/diff.tests b/release/src/router/busybox/testsuite/diff.tests new file mode 100755 index 00000000..ac68a089 --- /dev/null +++ b/release/src/router/busybox/testsuite/diff.tests @@ -0,0 +1,124 @@ +#!/bin/sh +# Copyright 2008 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# testing "test name" "options" "expected result" "file input" "stdin" + +# diff outputs date/time in the header, which should not be analysed +# NB: sed has tab character in s command! +TRIM_TAB="sed 's/ .*//'" + +testing "diff of stdin" \ + "diff -u - input | $TRIM_TAB" \ +"\ +--- - ++++ input +@@ -1 +1,3 @@ ++qwe + asd ++zxc +" \ + "qwe\nasd\nzxc\n" \ + "asd\n" + +testing "diff of stdin, no newline in the file" \ + "diff -u - input | $TRIM_TAB" \ +"\ +--- - ++++ input +@@ -1 +1,3 @@ ++qwe + asd ++zxc +\\ No newline at end of file +" \ + "qwe\nasd\nzxc" \ + "asd\n" + +# we also test that stdin is in fact NOT read +testing "diff of stdin, twice" \ + "diff - -; echo $?; wc -c" \ + "0\n5\n" \ + "" \ + "stdin" + +# testing "test name" "options" "expected result" "file input" "stdin" + +rm -rf diff1 diff2 +mkdir diff1 diff2 diff2/subdir +echo qwe >diff1/- +echo asd >diff2/subdir/- +testing "diff diff1 diff2/subdir" \ + "diff -ur diff1 diff2/subdir | $TRIM_TAB" \ +"\ +--- diff1/- ++++ diff2/subdir/- +@@ -1 +1 @@ +-qwe ++asd +" \ + "" "" + +# using directory structure from prev test... +testing "diff dir dir2/file/-" \ + "diff -ur diff1 diff2/subdir/- | $TRIM_TAB" \ +"\ +--- diff1/- ++++ diff2/subdir/- +@@ -1 +1 @@ +-qwe ++asd +" \ + "" "" + +# using directory structure from prev test... +mkdir diff1/test +mkfifo diff2/subdir/test +testing "diff of dir and fifo" \ + "diff -ur diff1 diff2/subdir | $TRIM_TAB" \ +"\ +--- diff1/- ++++ diff2/subdir/- +@@ -1 +1 @@ +-qwe ++asd +Only in diff2/subdir: test +" \ + "" "" + +# using directory structure from prev test... +rmdir diff1/test +echo >diff1/test +testing "diff of file and fifo" \ + "diff -ur diff1 diff2/subdir | $TRIM_TAB" \ +"\ +--- diff1/- ++++ diff2/subdir/- +@@ -1 +1 @@ +-qwe ++asd +File diff2/subdir/test is not a regular file or directory and was skipped +" \ + "" "" + +# using directory structure from prev test... +mkfifo diff1/test2 +testing "diff -rN does not read non-regular files" \ + "diff -urN diff1 diff2/subdir | $TRIM_TAB" \ +"\ +--- diff1/- ++++ diff2/subdir/- +@@ -1 +1 @@ +-qwe ++asd +File diff2/subdir/test is not a regular file or directory and was skipped +File diff1/test2 is not a regular file or directory and was skipped +" \ + "" "" + +# clean up +rm -rf diff1 diff2 + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/dirname/dirname-handles-absolute-path b/release/src/router/busybox/testsuite/dirname/dirname-handles-absolute-path old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/dirname/dirname-handles-empty-path b/release/src/router/busybox/testsuite/dirname/dirname-handles-empty-path old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/dirname/dirname-handles-multiple-slashes b/release/src/router/busybox/testsuite/dirname/dirname-handles-multiple-slashes old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/dirname/dirname-handles-relative-path b/release/src/router/busybox/testsuite/dirname/dirname-handles-relative-path old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/dirname/dirname-handles-root b/release/src/router/busybox/testsuite/dirname/dirname-handles-root old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/dirname/dirname-handles-single-component b/release/src/router/busybox/testsuite/dirname/dirname-handles-single-component old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/dirname/dirname-works b/release/src/router/busybox/testsuite/dirname/dirname-works new file mode 100644 index 00000000..f339c8f7 --- /dev/null +++ b/release/src/router/busybox/testsuite/dirname/dirname-works @@ -0,0 +1,2 @@ +test x$(dirname $(pwd)) = x$(busybox dirname $(pwd)) + diff --git a/release/src/router/busybox/testsuite/du/du-h-works b/release/src/router/busybox/testsuite/du/du-h-works new file mode 100644 index 00000000..3f8ff3d0 --- /dev/null +++ b/release/src/router/busybox/testsuite/du/du-h-works @@ -0,0 +1,4 @@ +d=/bin +du -h "$d" > logfile.gnu +busybox du -h "$d" > logfile.bb +cmp logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/du/du-k-works b/release/src/router/busybox/testsuite/du/du-k-works new file mode 100644 index 00000000..6c2c5d07 --- /dev/null +++ b/release/src/router/busybox/testsuite/du/du-k-works @@ -0,0 +1,4 @@ +d=/bin +du -k "$d" > logfile.gnu +busybox du -k "$d" > logfile.bb +cmp logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/du/du-l-works b/release/src/router/busybox/testsuite/du/du-l-works new file mode 100644 index 00000000..c3d2ec0c --- /dev/null +++ b/release/src/router/busybox/testsuite/du/du-l-works @@ -0,0 +1,4 @@ +d=/bin +du -l "$d" > logfile.gnu +busybox du -l "$d" > logfile.bb +cmp logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/du/du-m-works b/release/src/router/busybox/testsuite/du/du-m-works new file mode 100644 index 00000000..bf0a90e1 --- /dev/null +++ b/release/src/router/busybox/testsuite/du/du-m-works @@ -0,0 +1,4 @@ +d=/bin +du -m "$d" > logfile.gnu +busybox du -m "$d" > logfile.bb +cmp logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/du/du-s-works b/release/src/router/busybox/testsuite/du/du-s-works new file mode 100644 index 00000000..ae970772 --- /dev/null +++ b/release/src/router/busybox/testsuite/du/du-s-works @@ -0,0 +1,4 @@ +d=/bin +du -s "$d" > logfile.gnu +busybox du -s "$d" > logfile.bb +cmp logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/du/du-works b/release/src/router/busybox/testsuite/du/du-works new file mode 100644 index 00000000..46a336dc --- /dev/null +++ b/release/src/router/busybox/testsuite/du/du-works @@ -0,0 +1,4 @@ +d=/bin +du "$d" > logfile.gnu +busybox du "$d" > logfile.bb +cmp logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/echo/echo-does-not-print-newline b/release/src/router/busybox/testsuite/echo/echo-does-not-print-newline old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/echo/echo-prints-argument b/release/src/router/busybox/testsuite/echo/echo-prints-argument old mode 100755 new mode 100644 index 98779dbb..479dac89 --- a/release/src/router/busybox/testsuite/echo/echo-prints-argument +++ b/release/src/router/busybox/testsuite/echo/echo-prints-argument @@ -1 +1 @@ -test `busybox echo fubar` = fubar +test xfubar = x`busybox echo fubar` diff --git a/release/src/router/busybox/testsuite/echo/echo-prints-arguments b/release/src/router/busybox/testsuite/echo/echo-prints-arguments old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/echo/echo-prints-newline b/release/src/router/busybox/testsuite/echo/echo-prints-newline old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/echo/echo-prints-slash-zero b/release/src/router/busybox/testsuite/echo/echo-prints-slash-zero new file mode 100644 index 00000000..d2466326 --- /dev/null +++ b/release/src/router/busybox/testsuite/echo/echo-prints-slash-zero @@ -0,0 +1 @@ +test "`busybox echo -e -n 'msg\n\0' | od -t x1 | head -n 1`" = "0000000 6d 73 67 0a 00" diff --git a/release/src/router/busybox/testsuite/expand.tests b/release/src/router/busybox/testsuite/expand.tests new file mode 100755 index 00000000..3f4cda3f --- /dev/null +++ b/release/src/router/busybox/testsuite/expand.tests @@ -0,0 +1,15 @@ +#!/bin/sh +# Copyright 2008 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# testing "test name" "options" "expected result" "file input" "stdin" + +testing "expand" \ + "expand" \ + " 12345678 12345678\n" \ + "" \ + "\t12345678\t12345678\n" \ + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/expand/expand-works-like-GNU b/release/src/router/busybox/testsuite/expand/expand-works-like-GNU new file mode 100644 index 00000000..ee8c793e --- /dev/null +++ b/release/src/router/busybox/testsuite/expand/expand-works-like-GNU @@ -0,0 +1,18 @@ +rm -f foo bar +echo -e "\ty" | expand -t 3 ../../busybox > foo +echo -e "\ty" | busybox unexpand -t 3 ../../busybox > bar +set +e +test ! -f foo -a -f bar +if [ $? = 0 ] ; then + set -e + diff -q foo bar +fi +rm -f foo bar +echo -e "\ty\tx" | expand -it 3 ../../busybox > foo +echo -e "\ty\tx" | busybox unexpand -it 3 ../../busybox > bar +set +e +test ! -f foo -a -f bar +if [ $? = 0 ] ; then + set -e + diff -q foo bar +fi diff --git a/release/src/router/busybox/testsuite/expr/expr-big b/release/src/router/busybox/testsuite/expr/expr-big new file mode 100644 index 00000000..23dbbb3c --- /dev/null +++ b/release/src/router/busybox/testsuite/expr/expr-big @@ -0,0 +1,16 @@ +# busybox expr + +# 3*1000*1000*1000 overflows 32-bit signed int +res=`busybox expr 0 '<' 3000000000` +[ x"$res" = x1 ] || exit 1 + +# 9223372036854775807 = 2^31-1 +res=`busybox expr 0 '<' 9223372036854775807` +[ x"$res" = x1 ] || exit 1 +# coreutils fails this one! +res=`busybox expr -9223372036854775800 '<' 9223372036854775807` +[ x"$res" = x1 ] || exit 1 + +# This one works only by chance +# res=`busybox expr 0 '<' 9223372036854775808` +# [ x"$res" = x1 ] || exit 1 diff --git a/release/src/router/busybox/testsuite/expr/expr-works b/release/src/router/busybox/testsuite/expr/expr-works new file mode 100644 index 00000000..af49ac4d --- /dev/null +++ b/release/src/router/busybox/testsuite/expr/expr-works @@ -0,0 +1,59 @@ +# busybox expr +busybox expr 1 \| 1 +busybox expr 1 \| 0 +busybox expr 0 \| 1 +busybox expr 1 \& 1 +busybox expr 0 \< 1 +busybox expr 1 \> 0 +busybox expr 0 \<= 1 +busybox expr 1 \<= 1 +busybox expr 1 \>= 0 +busybox expr 1 \>= 1 +busybox expr 1 + 2 +busybox expr 2 - 1 +busybox expr 2 \* 3 +busybox expr 12 / 2 +busybox expr 12 % 5 + + +set +e +busybox expr 0 \| 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 1 \& 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 0 \& 1 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 0 \& 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 1 \< 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 0 \> 1 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 1 \<= 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 0 \>= 1 +if [ $? != 1 ] ; then + exit 1; +fi; + diff --git a/release/src/router/busybox/testsuite/false/false-is-silent b/release/src/router/busybox/testsuite/false/false-is-silent old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/false/false-returns-failure b/release/src/router/busybox/testsuite/false/false-returns-failure old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/find/find-supports-minus-xdev b/release/src/router/busybox/testsuite/find/find-supports-minus-xdev old mode 100755 new mode 100644 index 1c8818cd..4c559a1f --- a/release/src/router/busybox/testsuite/find/find-supports-minus-xdev +++ b/release/src/router/busybox/testsuite/find/find-supports-minus-xdev @@ -1,2 +1 @@ -# XFAIL busybox find . -xdev >/dev/null 2>&1 diff --git a/release/src/router/busybox/testsuite/grep.tests b/release/src/router/busybox/testsuite/grep.tests new file mode 100755 index 00000000..8cee1b9e --- /dev/null +++ b/release/src/router/busybox/testsuite/grep.tests @@ -0,0 +1,88 @@ +#!/bin/sh + +# Copyright 2005 by Rob Landley +# Licensed under GPL v2, see file LICENSE for details. + +# AUDIT: + +. testing.sh + +# testing "test name" "options" "expected result" "file input" "stdin" +# file input will be file called "input" +# test can create a file "actual" instead of writing to stdout + +# Test exit status + +testing "grep (exit with error)" "grep nonexistent 2> /dev/null ; echo \$?" \ + "1\n" "" "" +testing "grep (exit success)" "grep grep $0 > /dev/null 2>&1 ; echo \$?" "0\n" \ + "" "" +# Test various data sources and destinations + +testing "grep (default to stdin)" "grep two" "two\n" "" \ + "one\ntwo\nthree\nthree\nthree\n" +testing "grep - (specify stdin)" "grep two -" "two\n" "" \ + "one\ntwo\nthree\nthree\nthree\n" +testing "grep input (specify file)" "grep two input" "two\n" \ + "one\ntwo\nthree\nthree\nthree\n" "" + +# GNU grep 2.5.3 outputs a new line character after the located string +# even if there is no new line character in the input +testing "grep (no newline at EOL)" "grep bug input" "bug\n" "bug" "" + +>empty +testing "grep two files" "grep two input empty 2>/dev/null" \ + "input:two\n" "one\ntwo\nthree\nthree\nthree\n" "" +rm empty + +testing "grep - infile (specify stdin and file)" "grep two - input" \ + "(standard input):two\ninput:two\n" "one\ntwo\nthree\n" \ + "one\ntwo\ntoo\nthree\nthree\n" + +# Check if we see the correct return value if both stdin and non-existing file +# are given. +testing "grep - nofile (specify stdin and nonexisting file)" \ + "grep two - nonexistent 2> /dev/null ; echo \$?" \ + "(standard input):two\n(standard input):two\n2\n" \ + "" "one\ntwo\ntwo\nthree\nthree\nthree\n" +testing "grep -q - nofile (specify stdin and nonexisting file, no match)" \ + "grep -q nomatch - nonexistent 2> /dev/null ; echo \$?" \ + "2\n" "" "one\ntwo\ntwo\nthree\nthree\nthree\n" +# SUSv3: If the -q option is specified, the exit status shall be zero +# if an input line is selected, even if an error was detected. +testing "grep -q - nofile (specify stdin and nonexisting file, match)" \ + "grep -q two - nonexistent ; echo \$?" \ + "0\n" "" "one\ntwo\ntwo\nthree\nthree\nthree\n" + +# Test various command line options +# -s no error messages +testing "grep -s nofile (nonexisting file, no match)" \ + "grep -s nomatch nonexistent ; echo \$?" "2\n" "" "" +testing "grep -s nofile - (stdin and nonexisting file, match)" \ + "grep -s domatch nonexistent - ; echo \$?" \ + "(standard input):domatch\n2\n" "" "nomatch\ndomatch\nend\n" + +testing "grep handles NUL in files" "grep -a foo input" "\0foo\n" "\0foo\n\n" "" +testing "grep handles NUL on stdin" "grep -a foo" "\0foo\n" "" "\0foo\n\n" + +testing "grep matches NUL" "grep . input > /dev/null 2>&1 ; echo \$?" \ + "0\n" "\0\n" "" + +# -e regex +testing "grep handles multiple regexps" "grep -e one -e two input ; echo \$?" \ + "one\ntwo\n0\n" "one\ntwo\n" "" +testing "grep -F handles multiple expessions" "grep -F -e one -e two input ; echo \$?" \ + "one\ntwo\n0\n" "one\ntwo\n" "" + +# -f file/- +testing "grep can read regexps from stdin" "grep -f - input ; echo \$?" \ + "two\nthree\n0\n" "tw\ntwo\nthree\n" "tw.\nthr\n" + +optional FEATURE_GREP_EGREP_ALIAS +testing "grep -E supports extended regexps" "grep -E fo+" "foo\n" "" \ + "b\ar\nfoo\nbaz" +testing "grep is also egrep" "egrep foo" "foo\n" "" "foo\nbar\n" +testing "egrep is not case insensitive" \ + "egrep foo ; [ \$? -ne 0 ] && echo yes" "yes\n" "" "FOO\n" + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/grep/egrep-is-not-case-insensitive b/release/src/router/busybox/testsuite/grep/egrep-is-not-case-insensitive deleted file mode 100755 index 88160739..00000000 --- a/release/src/router/busybox/testsuite/grep/egrep-is-not-case-insensitive +++ /dev/null @@ -1,2 +0,0 @@ -# FEATURE: CONFIG_FEATURE_GREP_EGREP_ALIAS -test x`echo foo | busybox egrep FOO` = x diff --git a/release/src/router/busybox/testsuite/grep/egrep-supports-extended-regexps b/release/src/router/busybox/testsuite/grep/egrep-supports-extended-regexps deleted file mode 100755 index 6ef8b915..00000000 --- a/release/src/router/busybox/testsuite/grep/egrep-supports-extended-regexps +++ /dev/null @@ -1,2 +0,0 @@ -# FEATURE: CONFIG_FEATURE_GREP_EGREP_ALIAS -echo foo | busybox egrep fo+ diff --git a/release/src/router/busybox/testsuite/grep/grep-handles-binary-files b/release/src/router/busybox/testsuite/grep/grep-handles-binary-files deleted file mode 100755 index edb2042e..00000000 --- a/release/src/router/busybox/testsuite/grep/grep-handles-binary-files +++ /dev/null @@ -1 +0,0 @@ -echo -e '\0foo' | busybox grep foo diff --git a/release/src/router/busybox/testsuite/grep/grep-handles-multiple-regexps b/release/src/router/busybox/testsuite/grep/grep-handles-multiple-regexps deleted file mode 100755 index 5c1b8de1..00000000 --- a/release/src/router/busybox/testsuite/grep/grep-handles-multiple-regexps +++ /dev/null @@ -1 +0,0 @@ -echo foo | busybox grep -e foo -e bar diff --git a/release/src/router/busybox/testsuite/grep/grep-is-also-egrep b/release/src/router/busybox/testsuite/grep/grep-is-also-egrep deleted file mode 100755 index 2e6977c2..00000000 --- a/release/src/router/busybox/testsuite/grep/grep-is-also-egrep +++ /dev/null @@ -1,2 +0,0 @@ -# FEATURE: CONFIG_FEATURE_GREP_EGREP_ALIAS -echo foo | busybox egrep foo diff --git a/release/src/router/busybox/testsuite/grep/grep-matches-NUL b/release/src/router/busybox/testsuite/grep/grep-matches-NUL deleted file mode 100755 index 597d22cb..00000000 --- a/release/src/router/busybox/testsuite/grep/grep-matches-NUL +++ /dev/null @@ -1,2 +0,0 @@ -# XFAIL -echo -e '\0' | busybox grep . diff --git a/release/src/router/busybox/testsuite/gunzip.tests b/release/src/router/busybox/testsuite/gunzip.tests new file mode 100755 index 00000000..d7810044 --- /dev/null +++ b/release/src/router/busybox/testsuite/gunzip.tests @@ -0,0 +1,3 @@ +#!/bin/sh + +. bunzip2.tests diff --git a/release/src/router/busybox/testsuite/gunzip/gunzip-reads-from-standard-input b/release/src/router/busybox/testsuite/gunzip/gunzip-reads-from-standard-input old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/gzip/gzip-accepts-multiple-files b/release/src/router/busybox/testsuite/gzip/gzip-accepts-multiple-files old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/gzip/gzip-accepts-single-minus b/release/src/router/busybox/testsuite/gzip/gzip-accepts-single-minus old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/gzip/gzip-removes-original-file b/release/src/router/busybox/testsuite/gzip/gzip-removes-original-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/head/head-n-works b/release/src/router/busybox/testsuite/head/head-n-works new file mode 100644 index 00000000..db432555 --- /dev/null +++ b/release/src/router/busybox/testsuite/head/head-n-works @@ -0,0 +1,4 @@ +[ -n "$d" ] || d=.. +head -n 2 "$d/README" > logfile.gnu +busybox head -n 2 "$d/README" > logfile.bb +cmp logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/head/head-works b/release/src/router/busybox/testsuite/head/head-works new file mode 100644 index 00000000..56ad3e36 --- /dev/null +++ b/release/src/router/busybox/testsuite/head/head-works @@ -0,0 +1,4 @@ +[ -n "$d" ] || d=.. +head "$d/README" > logfile.gnu +busybox head "$d/README" > logfile.bb +cmp logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/hostid/hostid-works b/release/src/router/busybox/testsuite/hostid/hostid-works new file mode 100644 index 00000000..e85698e6 --- /dev/null +++ b/release/src/router/busybox/testsuite/hostid/hostid-works @@ -0,0 +1,2 @@ +test x$(hostid) = x$(busybox hostid) + diff --git a/release/src/router/busybox/testsuite/hostname/hostname-d-works b/release/src/router/busybox/testsuite/hostname/hostname-d-works new file mode 100644 index 00000000..a9aeb92c --- /dev/null +++ b/release/src/router/busybox/testsuite/hostname/hostname-d-works @@ -0,0 +1,2 @@ +test x$(hostname -d) = x$(busybox hostname -d) + diff --git a/release/src/router/busybox/testsuite/hostname/hostname-i-works b/release/src/router/busybox/testsuite/hostname/hostname-i-works new file mode 100644 index 00000000..68a3e678 --- /dev/null +++ b/release/src/router/busybox/testsuite/hostname/hostname-i-works @@ -0,0 +1,2 @@ +test x$(hostname -i) = x$(busybox hostname -i) + diff --git a/release/src/router/busybox/testsuite/hostname/hostname-s-works b/release/src/router/busybox/testsuite/hostname/hostname-s-works new file mode 100644 index 00000000..172b9440 --- /dev/null +++ b/release/src/router/busybox/testsuite/hostname/hostname-s-works @@ -0,0 +1 @@ +test x$(hostname -s) = x$(busybox hostname -s) diff --git a/release/src/router/busybox/testsuite/hostname/hostname-works b/release/src/router/busybox/testsuite/hostname/hostname-works new file mode 100644 index 00000000..f51a406e --- /dev/null +++ b/release/src/router/busybox/testsuite/hostname/hostname-works @@ -0,0 +1 @@ +test x$(hostname) = x$(busybox hostname) diff --git a/release/src/router/busybox/testsuite/id/id-g-works b/release/src/router/busybox/testsuite/id/id-g-works new file mode 100644 index 00000000..671fc536 --- /dev/null +++ b/release/src/router/busybox/testsuite/id/id-g-works @@ -0,0 +1 @@ +test x$(id -g) = x$(busybox id -g) diff --git a/release/src/router/busybox/testsuite/id/id-u-works b/release/src/router/busybox/testsuite/id/id-u-works new file mode 100644 index 00000000..2358cb0d --- /dev/null +++ b/release/src/router/busybox/testsuite/id/id-u-works @@ -0,0 +1 @@ +test x$(id -u) = x$(busybox id -u) diff --git a/release/src/router/busybox/testsuite/id/id-un-works b/release/src/router/busybox/testsuite/id/id-un-works new file mode 100644 index 00000000..db390e73 --- /dev/null +++ b/release/src/router/busybox/testsuite/id/id-un-works @@ -0,0 +1 @@ +test x$(id -un) = x$(busybox id -un) diff --git a/release/src/router/busybox/testsuite/id/id-ur-works b/release/src/router/busybox/testsuite/id/id-ur-works new file mode 100644 index 00000000..6b0fcb03 --- /dev/null +++ b/release/src/router/busybox/testsuite/id/id-ur-works @@ -0,0 +1 @@ +test x$(id -ur) = x$(busybox id -ur) diff --git a/release/src/router/busybox/testsuite/ln/ln-creates-hard-links b/release/src/router/busybox/testsuite/ln/ln-creates-hard-links new file mode 100644 index 00000000..2f6e23f9 --- /dev/null +++ b/release/src/router/busybox/testsuite/ln/ln-creates-hard-links @@ -0,0 +1,4 @@ +echo file number one > file1 +busybox ln file1 link1 +test -f file1 +test -f link1 diff --git a/release/src/router/busybox/testsuite/ln/ln-creates-soft-links b/release/src/router/busybox/testsuite/ln/ln-creates-soft-links new file mode 100644 index 00000000..e875e4c8 --- /dev/null +++ b/release/src/router/busybox/testsuite/ln/ln-creates-soft-links @@ -0,0 +1,4 @@ +echo file number one > file1 +busybox ln -s file1 link1 +test -L link1 +test xfile1 = x`readlink link1` diff --git a/release/src/router/busybox/testsuite/ln/ln-force-creates-hard-links b/release/src/router/busybox/testsuite/ln/ln-force-creates-hard-links new file mode 100644 index 00000000..c96b7d6c --- /dev/null +++ b/release/src/router/busybox/testsuite/ln/ln-force-creates-hard-links @@ -0,0 +1,5 @@ +echo file number one > file1 +echo file number two > link1 +busybox ln -f file1 link1 +test -f file1 +test -f link1 diff --git a/release/src/router/busybox/testsuite/ln/ln-force-creates-soft-links b/release/src/router/busybox/testsuite/ln/ln-force-creates-soft-links new file mode 100644 index 00000000..cab8d1db --- /dev/null +++ b/release/src/router/busybox/testsuite/ln/ln-force-creates-soft-links @@ -0,0 +1,5 @@ +echo file number one > file1 +echo file number two > link1 +busybox ln -f -s file1 link1 +test -L link1 +test xfile1 = x`readlink link1` diff --git a/release/src/router/busybox/testsuite/ln/ln-preserves-hard-links b/release/src/router/busybox/testsuite/ln/ln-preserves-hard-links new file mode 100644 index 00000000..47fb9896 --- /dev/null +++ b/release/src/router/busybox/testsuite/ln/ln-preserves-hard-links @@ -0,0 +1,8 @@ +echo file number one > file1 +echo file number two > link1 +set +e +busybox ln file1 link1 +if [ $? != 0 ] ; then + exit 0; +fi +exit 1; diff --git a/release/src/router/busybox/testsuite/ln/ln-preserves-soft-links b/release/src/router/busybox/testsuite/ln/ln-preserves-soft-links new file mode 100644 index 00000000..a8123ece --- /dev/null +++ b/release/src/router/busybox/testsuite/ln/ln-preserves-soft-links @@ -0,0 +1,9 @@ +echo file number one > file1 +echo file number two > link1 +set +e +busybox ln -s file1 link1 +if [ $? != 0 ] ; then + exit 0; +fi +exit 1; + diff --git a/release/src/router/busybox/testsuite/ls/ls-1-works b/release/src/router/busybox/testsuite/ls/ls-1-works new file mode 100644 index 00000000..88569492 --- /dev/null +++ b/release/src/router/busybox/testsuite/ls/ls-1-works @@ -0,0 +1,4 @@ +[ -n "$d" ] || d=.. +LC_ALL=C ls -1 "$d" > logfile.gnu +LC_ALL=C busybox ls -1 "$d" > logfile.bb +diff -ubw logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/ls/ls-h-works b/release/src/router/busybox/testsuite/ls/ls-h-works new file mode 100644 index 00000000..0c83f7cc --- /dev/null +++ b/release/src/router/busybox/testsuite/ls/ls-h-works @@ -0,0 +1,4 @@ +[ -n "$d" ] || d=.. +LC_ALL=C ls -h "$d" > logfile.gnu +LC_ALL=C busybox ls -h "$d" > logfile.bb +diff -ubw logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/ls/ls-l-works b/release/src/router/busybox/testsuite/ls/ls-l-works new file mode 100644 index 00000000..1bad34bc --- /dev/null +++ b/release/src/router/busybox/testsuite/ls/ls-l-works @@ -0,0 +1,4 @@ +[ -n "$d" ] || d=.. +LC_ALL=C ls -l "$d" > logfile.gnu +LC_ALL=C busybox ls -l "$d" > logfile.bb +diff -ubw logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/ls/ls-s-works b/release/src/router/busybox/testsuite/ls/ls-s-works new file mode 100644 index 00000000..0a9d7526 --- /dev/null +++ b/release/src/router/busybox/testsuite/ls/ls-s-works @@ -0,0 +1,4 @@ +[ -n "$d" ] || d=.. +LC_ALL=C ls -1s "$d" > logfile.gnu +LC_ALL=C busybox ls -1s "$d" > logfile.bb +diff -ubw logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/makedevs.device_table.txt b/release/src/router/busybox/testsuite/makedevs.device_table.txt new file mode 100644 index 00000000..4400083f --- /dev/null +++ b/release/src/router/busybox/testsuite/makedevs.device_table.txt @@ -0,0 +1,172 @@ +# When building a target filesystem, it is desirable to not have to +# become root and then run 'mknod' a thousand times. Using a device +# table you can create device nodes and directories "on the fly". +# +# This is a sample device table file for use with genext2fs. You can +# do all sorts of interesting things with a device table file. For +# example, if you want to adjust the permissions on a particular file +# you can just add an entry like: +# /sbin/foobar f 2755 0 0 - - - - - +# and (assuming the file /sbin/foobar exists) it will be made setuid +# root (regardless of what its permissions are on the host filesystem. +# Furthermore, you can use a single table entry to create a many device +# minors. For example, if I wanted to create /dev/hda and /dev/hda[0-15] +# I could just use the following two table entries: +# /dev/hda b 640 0 0 3 0 0 0 - +# /dev/hda b 640 0 0 3 1 1 1 15 +# +# Device table entries take the form of: +# +# where name is the file name, type can be one of: +# f A regular file +# d Directory +# c Character special device file +# b Block special device file +# p Fifo (named pipe) +# uid is the user id for the target file, gid is the group id for the +# target file. The rest of the entries (major, minor, etc) apply only +# to device special files. + +# Have fun +# -Erik Andersen +# + +# +/dev d 755 0 0 - - - - - +/dev/pts d 755 0 0 - - - - - +/dev/shm d 755 0 0 - - - - - +/tmp d 1777 0 0 - - - - - +/etc d 755 0 0 - - - - - +/home/default d 2755 1000 1000 - - - - - +# +###/bin/busybox f 4755 0 0 - - - - - +###/etc/shadow f 600 0 0 - - - - - +###/etc/passwd f 644 0 0 - - - - - +/etc/network/if-up.d d 755 0 0 - - - - - +/etc/network/if-pre-up.d d 755 0 0 - - - - - +/etc/network/if-down.d d 755 0 0 - - - - - +/etc/network/if-post-down.d d 755 0 0 - - - - - +###/usr/share/udhcpc/default.script f 755 0 0 - - - - - +# uncomment this to allow starting x as non-root +#/usr/X11R6/bin/Xfbdev f 4755 0 0 - - - - - + +# Normal system devices +# +/dev/mem c 640 0 0 1 1 0 0 - +/dev/kmem c 640 0 0 1 2 0 0 - +/dev/null c 666 0 0 1 3 0 0 - +/dev/zero c 666 0 0 1 5 0 0 - +/dev/random c 666 0 0 1 8 0 0 - +/dev/urandom c 666 0 0 1 9 0 0 - +/dev/ram b 640 0 0 1 1 0 0 - +/dev/ram b 640 0 0 1 0 0 1 4 +/dev/loop b 640 0 0 7 0 0 1 2 +/dev/rtc c 640 0 0 10 135 - - - +/dev/console c 666 0 0 5 1 - - - +/dev/tty c 666 0 0 5 0 - - - +/dev/tty c 666 0 0 4 0 0 1 8 +/dev/ttyp c 666 0 0 3 0 0 1 10 +/dev/ptyp c 666 0 0 2 0 0 1 10 +/dev/ptmx c 666 0 0 5 2 - - - +/dev/ttyP c 666 0 0 57 0 0 1 4 +/dev/ttyS c 666 0 0 4 64 0 1 4 +/dev/fb c 640 0 5 29 0 0 32 4 +#/dev/ttySA c 666 0 0 204 5 0 1 3 +/dev/psaux c 666 0 0 10 1 0 0 - +#/dev/ppp c 666 0 0 108 0 - - - + +# Input stuff +/dev/input d 755 0 0 - - - - - +/dev/input/mice c 640 0 0 13 63 0 0 - +/dev/input/mouse c 660 0 0 13 32 0 1 4 +/dev/input/event c 660 0 0 13 64 0 1 4 +#/dev/input/js c 660 0 0 13 0 0 1 4 + + +# MTD stuff +/dev/mtd c 640 0 0 90 0 0 2 4 +/dev/mtdblock b 640 0 0 31 0 0 1 4 + +#Tun/tap driver +/dev/net d 755 0 0 - - - - - +/dev/net/tun c 660 0 0 10 200 - - - + +# Audio stuff +#/dev/audio c 666 0 29 14 4 - - - +#/dev/audio1 c 666 0 29 14 20 - - - +#/dev/dsp c 666 0 29 14 3 - - - +#/dev/dsp1 c 666 0 29 14 19 - - - +#/dev/sndstat c 666 0 29 14 6 - - - + +# User-mode Linux stuff +#/dev/ubda b 640 0 0 98 0 0 0 - +#/dev/ubda b 640 0 0 98 1 1 1 15 + +# IDE Devices +/dev/hda b 640 0 0 3 0 0 0 - +/dev/hda b 640 0 0 3 1 1 1 15 +/dev/hdb b 640 0 0 3 64 0 0 - +/dev/hdb b 640 0 0 3 65 1 1 15 +#/dev/hdc b 640 0 0 22 0 0 0 - +#/dev/hdc b 640 0 0 22 1 1 1 15 +#/dev/hdd b 640 0 0 22 64 0 0 - +#/dev/hdd b 640 0 0 22 65 1 1 15 +#/dev/hde b 640 0 0 33 0 0 0 - +#/dev/hde b 640 0 0 33 1 1 1 15 +#/dev/hdf b 640 0 0 33 64 0 0 - +#/dev/hdf b 640 0 0 33 65 1 1 15 +#/dev/hdg b 640 0 0 34 0 0 0 - +#/dev/hdg b 640 0 0 34 1 1 1 15 +#/dev/hdh b 640 0 0 34 64 0 0 - +#/dev/hdh b 640 0 0 34 65 1 1 15 + +# SCSI Devices +#/dev/sda b 640 0 0 8 0 0 0 - +#/dev/sda b 640 0 0 8 1 1 1 15 +#/dev/sdb b 640 0 0 8 16 0 0 - +#/dev/sdb b 640 0 0 8 17 1 1 15 +#/dev/sdc b 640 0 0 8 32 0 0 - +#/dev/sdc b 640 0 0 8 33 1 1 15 +#/dev/sdd b 640 0 0 8 48 0 0 - +#/dev/sdd b 640 0 0 8 49 1 1 15 +#/dev/sde b 640 0 0 8 64 0 0 - +#/dev/sde b 640 0 0 8 65 1 1 15 +#/dev/sdf b 640 0 0 8 80 0 0 - +#/dev/sdf b 640 0 0 8 81 1 1 15 +#/dev/sdg b 640 0 0 8 96 0 0 - +#/dev/sdg b 640 0 0 8 97 1 1 15 +#/dev/sdh b 640 0 0 8 112 0 0 - +#/dev/sdh b 640 0 0 8 113 1 1 15 +#/dev/sg c 640 0 0 21 0 0 1 15 +#/dev/scd b 640 0 0 11 0 0 1 15 +#/dev/st c 640 0 0 9 0 0 1 8 +#/dev/nst c 640 0 0 9 128 0 1 8 +#/dev/st c 640 0 0 9 32 1 1 4 +#/dev/st c 640 0 0 9 64 1 1 4 +#/dev/st c 640 0 0 9 96 1 1 4 + +# Floppy disk devices +#/dev/fd b 640 0 0 2 0 0 1 2 +#/dev/fd0d360 b 640 0 0 2 4 0 0 - +#/dev/fd1d360 b 640 0 0 2 5 0 0 - +#/dev/fd0h1200 b 640 0 0 2 8 0 0 - +#/dev/fd1h1200 b 640 0 0 2 9 0 0 - +#/dev/fd0u1440 b 640 0 0 2 28 0 0 - +#/dev/fd1u1440 b 640 0 0 2 29 0 0 - +#/dev/fd0u2880 b 640 0 0 2 32 0 0 - +#/dev/fd1u2880 b 640 0 0 2 33 0 0 - + +# All the proprietary cdrom devices in the world +#/dev/aztcd b 640 0 0 29 0 0 0 - +#/dev/bpcd b 640 0 0 41 0 0 0 - +#/dev/capi20 c 640 0 0 68 0 0 1 2 +#/dev/cdu31a b 640 0 0 15 0 0 0 - +#/dev/cdu535 b 640 0 0 24 0 0 0 - +#/dev/cm206cd b 640 0 0 32 0 0 0 - +#/dev/sjcd b 640 0 0 18 0 0 0 - +#/dev/sonycd b 640 0 0 15 0 0 0 - +#/dev/gscd b 640 0 0 16 0 0 0 - +#/dev/sbpcd b 640 0 0 25 0 0 0 - +#/dev/sbpcd b 640 0 0 25 0 0 1 4 +#/dev/mcd b 640 0 0 23 0 0 0 - +#/dev/optcd b 640 0 0 17 0 0 0 - diff --git a/release/src/router/busybox/testsuite/makedevs.tests b/release/src/router/busybox/testsuite/makedevs.tests new file mode 100755 index 00000000..9e068bdc --- /dev/null +++ b/release/src/router/busybox/testsuite/makedevs.tests @@ -0,0 +1,139 @@ +#!/bin/sh +# Copyright 2008 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# ls -ln is showing date. Need to remove that, it's variable +# sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces +# cut: remove date +FILTER_LS="sed -e 's/, */,/g' -e 's/ */ /g' | cut -d' ' -f 1-5,9-" +# cut: remove size+date +FILTER_LS2="sed -e 's/, */,/g' -e 's/ */ /g' | cut -d' ' -f 1-4,9-" + +# testing "test name" "options" "expected result" "file input" "stdin" + +rm -rf makedevs.testdir +mkdir makedevs.testdir + +testing "makedevs -d ../makedevs.device_table.txt ." \ + "(cd makedevs.testdir && makedevs -d ../makedevs.device_table.txt . 2>&1); + find makedevs.testdir ! -type d | sort | xargs ls -lnR | $FILTER_LS" \ +"\ +rootdir=. +table='../makedevs.device_table.txt' +crw-rw-rw- 1 0 0 5,1 makedevs.testdir/dev/console +crw-r----- 1 0 5 29,0 makedevs.testdir/dev/fb0 +crw-r----- 1 0 5 29,32 makedevs.testdir/dev/fb1 +crw-r----- 1 0 5 29,64 makedevs.testdir/dev/fb2 +crw-r----- 1 0 5 29,96 makedevs.testdir/dev/fb3 +brw-r----- 1 0 0 3,0 makedevs.testdir/dev/hda +brw-r----- 1 0 0 3,1 makedevs.testdir/dev/hda1 +brw-r----- 1 0 0 3,10 makedevs.testdir/dev/hda10 +brw-r----- 1 0 0 3,11 makedevs.testdir/dev/hda11 +brw-r----- 1 0 0 3,12 makedevs.testdir/dev/hda12 +brw-r----- 1 0 0 3,13 makedevs.testdir/dev/hda13 +brw-r----- 1 0 0 3,14 makedevs.testdir/dev/hda14 +brw-r----- 1 0 0 3,15 makedevs.testdir/dev/hda15 +brw-r----- 1 0 0 3,2 makedevs.testdir/dev/hda2 +brw-r----- 1 0 0 3,3 makedevs.testdir/dev/hda3 +brw-r----- 1 0 0 3,4 makedevs.testdir/dev/hda4 +brw-r----- 1 0 0 3,5 makedevs.testdir/dev/hda5 +brw-r----- 1 0 0 3,6 makedevs.testdir/dev/hda6 +brw-r----- 1 0 0 3,7 makedevs.testdir/dev/hda7 +brw-r----- 1 0 0 3,8 makedevs.testdir/dev/hda8 +brw-r----- 1 0 0 3,9 makedevs.testdir/dev/hda9 +brw-r----- 1 0 0 3,64 makedevs.testdir/dev/hdb +brw-r----- 1 0 0 3,65 makedevs.testdir/dev/hdb1 +brw-r----- 1 0 0 3,74 makedevs.testdir/dev/hdb10 +brw-r----- 1 0 0 3,75 makedevs.testdir/dev/hdb11 +brw-r----- 1 0 0 3,76 makedevs.testdir/dev/hdb12 +brw-r----- 1 0 0 3,77 makedevs.testdir/dev/hdb13 +brw-r----- 1 0 0 3,78 makedevs.testdir/dev/hdb14 +brw-r----- 1 0 0 3,79 makedevs.testdir/dev/hdb15 +brw-r----- 1 0 0 3,66 makedevs.testdir/dev/hdb2 +brw-r----- 1 0 0 3,67 makedevs.testdir/dev/hdb3 +brw-r----- 1 0 0 3,68 makedevs.testdir/dev/hdb4 +brw-r----- 1 0 0 3,69 makedevs.testdir/dev/hdb5 +brw-r----- 1 0 0 3,70 makedevs.testdir/dev/hdb6 +brw-r----- 1 0 0 3,71 makedevs.testdir/dev/hdb7 +brw-r----- 1 0 0 3,72 makedevs.testdir/dev/hdb8 +brw-r----- 1 0 0 3,73 makedevs.testdir/dev/hdb9 +crw-rw---- 1 0 0 13,64 makedevs.testdir/dev/input/event0 +crw-rw---- 1 0 0 13,65 makedevs.testdir/dev/input/event1 +crw-rw---- 1 0 0 13,66 makedevs.testdir/dev/input/event2 +crw-rw---- 1 0 0 13,67 makedevs.testdir/dev/input/event3 +crw-r----- 1 0 0 13,63 makedevs.testdir/dev/input/mice +crw-rw---- 1 0 0 13,32 makedevs.testdir/dev/input/mouse0 +crw-rw---- 1 0 0 13,33 makedevs.testdir/dev/input/mouse1 +crw-rw---- 1 0 0 13,34 makedevs.testdir/dev/input/mouse2 +crw-rw---- 1 0 0 13,35 makedevs.testdir/dev/input/mouse3 +crw-r----- 1 0 0 1,2 makedevs.testdir/dev/kmem +brw-r----- 1 0 0 7,0 makedevs.testdir/dev/loop0 +brw-r----- 1 0 0 7,1 makedevs.testdir/dev/loop1 +crw-r----- 1 0 0 1,1 makedevs.testdir/dev/mem +crw-r----- 1 0 0 90,0 makedevs.testdir/dev/mtd0 +crw-r----- 1 0 0 90,2 makedevs.testdir/dev/mtd1 +crw-r----- 1 0 0 90,4 makedevs.testdir/dev/mtd2 +crw-r----- 1 0 0 90,6 makedevs.testdir/dev/mtd3 +brw-r----- 1 0 0 31,0 makedevs.testdir/dev/mtdblock0 +brw-r----- 1 0 0 31,1 makedevs.testdir/dev/mtdblock1 +brw-r----- 1 0 0 31,2 makedevs.testdir/dev/mtdblock2 +brw-r----- 1 0 0 31,3 makedevs.testdir/dev/mtdblock3 +crw-rw---- 1 0 0 10,200 makedevs.testdir/dev/net/tun +crw-rw-rw- 1 0 0 1,3 makedevs.testdir/dev/null +crw-rw-rw- 1 0 0 10,1 makedevs.testdir/dev/psaux +crw-rw-rw- 1 0 0 5,2 makedevs.testdir/dev/ptmx +crw-rw-rw- 1 0 0 2,0 makedevs.testdir/dev/ptyp0 +crw-rw-rw- 1 0 0 2,1 makedevs.testdir/dev/ptyp1 +crw-rw-rw- 1 0 0 2,2 makedevs.testdir/dev/ptyp2 +crw-rw-rw- 1 0 0 2,3 makedevs.testdir/dev/ptyp3 +crw-rw-rw- 1 0 0 2,4 makedevs.testdir/dev/ptyp4 +crw-rw-rw- 1 0 0 2,5 makedevs.testdir/dev/ptyp5 +crw-rw-rw- 1 0 0 2,6 makedevs.testdir/dev/ptyp6 +crw-rw-rw- 1 0 0 2,7 makedevs.testdir/dev/ptyp7 +crw-rw-rw- 1 0 0 2,8 makedevs.testdir/dev/ptyp8 +crw-rw-rw- 1 0 0 2,9 makedevs.testdir/dev/ptyp9 +brw-r----- 1 0 0 1,1 makedevs.testdir/dev/ram +brw-r----- 1 0 0 1,0 makedevs.testdir/dev/ram0 +brw-r----- 1 0 0 1,1 makedevs.testdir/dev/ram1 +brw-r----- 1 0 0 1,2 makedevs.testdir/dev/ram2 +brw-r----- 1 0 0 1,3 makedevs.testdir/dev/ram3 +crw-rw-rw- 1 0 0 1,8 makedevs.testdir/dev/random +crw-r----- 1 0 0 10,135 makedevs.testdir/dev/rtc +crw-rw-rw- 1 0 0 5,0 makedevs.testdir/dev/tty +crw-rw-rw- 1 0 0 4,0 makedevs.testdir/dev/tty0 +crw-rw-rw- 1 0 0 4,1 makedevs.testdir/dev/tty1 +crw-rw-rw- 1 0 0 4,2 makedevs.testdir/dev/tty2 +crw-rw-rw- 1 0 0 4,3 makedevs.testdir/dev/tty3 +crw-rw-rw- 1 0 0 4,4 makedevs.testdir/dev/tty4 +crw-rw-rw- 1 0 0 4,5 makedevs.testdir/dev/tty5 +crw-rw-rw- 1 0 0 4,6 makedevs.testdir/dev/tty6 +crw-rw-rw- 1 0 0 4,7 makedevs.testdir/dev/tty7 +crw-rw-rw- 1 0 0 57,0 makedevs.testdir/dev/ttyP0 +crw-rw-rw- 1 0 0 57,1 makedevs.testdir/dev/ttyP1 +crw-rw-rw- 1 0 0 57,2 makedevs.testdir/dev/ttyP2 +crw-rw-rw- 1 0 0 57,3 makedevs.testdir/dev/ttyP3 +crw-rw-rw- 1 0 0 4,64 makedevs.testdir/dev/ttyS0 +crw-rw-rw- 1 0 0 4,65 makedevs.testdir/dev/ttyS1 +crw-rw-rw- 1 0 0 4,66 makedevs.testdir/dev/ttyS2 +crw-rw-rw- 1 0 0 4,67 makedevs.testdir/dev/ttyS3 +crw-rw-rw- 1 0 0 3,0 makedevs.testdir/dev/ttyp0 +crw-rw-rw- 1 0 0 3,1 makedevs.testdir/dev/ttyp1 +crw-rw-rw- 1 0 0 3,2 makedevs.testdir/dev/ttyp2 +crw-rw-rw- 1 0 0 3,3 makedevs.testdir/dev/ttyp3 +crw-rw-rw- 1 0 0 3,4 makedevs.testdir/dev/ttyp4 +crw-rw-rw- 1 0 0 3,5 makedevs.testdir/dev/ttyp5 +crw-rw-rw- 1 0 0 3,6 makedevs.testdir/dev/ttyp6 +crw-rw-rw- 1 0 0 3,7 makedevs.testdir/dev/ttyp7 +crw-rw-rw- 1 0 0 3,8 makedevs.testdir/dev/ttyp8 +crw-rw-rw- 1 0 0 3,9 makedevs.testdir/dev/ttyp9 +crw-rw-rw- 1 0 0 1,9 makedevs.testdir/dev/urandom +crw-rw-rw- 1 0 0 1,5 makedevs.testdir/dev/zero +" \ + "" "" + +# clean up +rm -rf makedevs.testdir + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/md5sum/md5sum-verifies-non-binary-file b/release/src/router/busybox/testsuite/md5sum/md5sum-verifies-non-binary-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/mdev.tests b/release/src/router/busybox/testsuite/mdev.tests new file mode 100755 index 00000000..90379e66 --- /dev/null +++ b/release/src/router/busybox/testsuite/mdev.tests @@ -0,0 +1,143 @@ +#!/bin/sh +# Copyright 2008 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# ls -ln is showing date. Need to remove that, it's variable +# sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces +# cut: remove date +FILTER_LS="sed -e 's/, */,/g' -e 's/ */ /g' | cut -d' ' -f 1-5,9-" +# cut: remove size+date +FILTER_LS2="sed -e 's/, */,/g' -e 's/ */ /g' | cut -d' ' -f 1-4,9-" + +# testing "test name" "options" "expected result" "file input" "stdin" + +rm -rf mdev.testdir +mkdir mdev.testdir +# We need mdev executable to be in chroot jail! +# (will still fail with dynamically linked one, though...) +cp ../busybox mdev.testdir/mdev +mkdir mdev.testdir/bin +cp ../busybox mdev.testdir/bin/sh 2>/dev/null # for testing cmd feature +mkdir mdev.testdir/etc +mkdir mdev.testdir/dev +mkdir -p mdev.testdir/sys/block/sda +echo "8:0" >mdev.testdir/sys/block/sda/dev + +# env - PATH=$PATH: on some systems chroot binary won't otherwise be found + +testing "mdev add /block/sda" \ + "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1; + ls -ln mdev.testdir/dev | $FILTER_LS" \ +"\ +brw-rw---- 1 0 0 8,0 sda +" \ + "" "" + +# continuing to use directory structure from prev test +rm -rf mdev.testdir/dev/* +echo ".* 1:1 666" >mdev.testdir/etc/mdev.conf +echo "sda 2:2 444" >>mdev.testdir/etc/mdev.conf +testing "mdev stops on first rule" \ + "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1; + ls -ln mdev.testdir/dev | $FILTER_LS" \ +"\ +brw-rw-rw- 1 1 1 8,0 sda +" \ + "" "" + +# continuing to use directory structure from prev test +rm -rf mdev.testdir/dev/* +echo "sda 0:0 444 >disk/scsiA" >mdev.testdir/etc/mdev.conf +testing "mdev move/symlink rule '>bar/baz'" \ + "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1; + ls -lnR mdev.testdir/dev | $FILTER_LS2" \ +"\ +mdev.testdir/dev: +drwxr-xr-x 2 0 0 disk +lrwxrwxrwx 1 0 0 sda -> disk/scsiA + +mdev.testdir/dev/disk: +br--r--r-- 1 0 0 scsiA +" \ + "" "" + +# continuing to use directory structure from prev test +rm -rf mdev.testdir/dev/* +echo "sda 0:0 444 >disk/" >mdev.testdir/etc/mdev.conf +testing "mdev move/symlink rule '>bar/'" \ + "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1; + ls -lnR mdev.testdir/dev | $FILTER_LS2" \ +"\ +mdev.testdir/dev: +drwxr-xr-x 2 0 0 disk +lrwxrwxrwx 1 0 0 sda -> disk/sda + +mdev.testdir/dev/disk: +br--r--r-- 1 0 0 sda +" \ + "" "" + +# continuing to use directory structure from prev test +rm -rf mdev.testdir/dev/* +# here we complicate things by having non-matching group 1 and using %0 +echo "s([0-9])*d([a-z]+) 0:0 644 >sd/%2_%0" >mdev.testdir/etc/mdev.conf +testing "mdev regexp substring match + replace" \ + "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1; + ls -lnR mdev.testdir/dev | $FILTER_LS2" \ +"\ +mdev.testdir/dev: +drwxr-xr-x 2 0 0 sd +lrwxrwxrwx 1 0 0 sda -> sd/a_sda + +mdev.testdir/dev/sd: +brw-r--r-- 1 0 0 a_sda +" \ + "" "" + +# continuing to use directory structure from prev test +rm -rf mdev.testdir/dev/* +echo "sda 0:0 644 @echo @echo TEST" >mdev.testdir/etc/mdev.conf +testing "mdev command" \ + "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1; + ls -lnR mdev.testdir/dev | $FILTER_LS" \ +"\ +@echo TEST +mdev.testdir/dev: +brw-r--r-- 1 0 0 8,0 sda +" \ + "" "" + +# continuing to use directory structure from prev test +rm -rf mdev.testdir/dev/* +echo "sda 0:0 644 =block/ @echo @echo TEST" >mdev.testdir/etc/mdev.conf +testing "mdev move and command" \ + "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1; + ls -lnR mdev.testdir/dev | $FILTER_LS2" \ +"\ +@echo TEST +mdev.testdir/dev: +drwxr-xr-x 2 0 0 block + +mdev.testdir/dev/block: +brw-r--r-- 1 0 0 sda +" \ + "" "" + +# continuing to use directory structure from prev test +rm -rf mdev.testdir/dev/* +echo "@8,0 :1 644" >mdev.testdir/etc/mdev.conf +testing "mdev #maj,min and no explicit uid" \ + "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1; + ls -lnR mdev.testdir/dev | $FILTER_LS" \ +"\ +mdev.testdir/dev: +brw-r--r-- 1 0 1 8,0 sda +" \ + "" "" + +# clean up +rm -rf mdev.testdir + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/mkdir/mkdir-makes-a-directory b/release/src/router/busybox/testsuite/mkdir/mkdir-makes-a-directory old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/mkdir/mkdir-makes-parent-directories b/release/src/router/busybox/testsuite/mkdir/mkdir-makes-parent-directories old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/mkfs.minix.tests b/release/src/router/busybox/testsuite/mkfs.minix.tests new file mode 100755 index 00000000..90df9316 --- /dev/null +++ b/release/src/router/busybox/testsuite/mkfs.minix.tests @@ -0,0 +1,22 @@ +#!/bin/sh + +# mkfs.minix tests. +# Copyright 2007 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# testing "test name" "options" "expected result" "file input" "stdin" + +testing "mkfs.minix" \ + "dd if=/dev/zero of=input bs=1k count=1024 2>/dev/null; mkfs.minix input; md5sum +# Licensed under GPL v2, see file LICENSE for details. + +if [ -z "$TESTDIR" ] +then + echo 'Need $TESTDIR' + exit 1 +fi + +cd "$TESTDIR" + +. testing.sh + +# If we aren't PID 1, barf. + +#if [ $$ -ne 1 ] +#then +# echo "SKIPPED: mount test requires emulation environment" +# exit 0 +#fi + +# Run tests within the chroot environment. +dochroot bash rm ls ln cat ps mknod mkdir dd grep cmp diff tail \ + mkfs.ext2 mkfs.vfat mount umount losetup wc << EOF +#!/bin/bash + +. /testing.sh + +mknod /dev/loop0 b 7 0 +mknod /dev/loop1 b 7 1 + +# We need /proc to do much. Make sure we can mount it explicitly. + +testing "mount no proc [GNUFAIL]" "mount 2> /dev/null || echo yes" "yes\n" "" "" +testing "mount /proc" "mount -t proc /proc /proc && ls -d /proc/1" \ + "/proc/1\n" "" "" + +# Make sure the last thing in the list is /proc + +testing "mount list1" "mount | tail -n 1" "/proc on /proc type proc (rw)\n" \ + "" "" + + +# Create an ext2 image + +mkdir -p images/{ext2.dir,vfat.dir,test1,test2,test3} +dd if=/dev/zero of=images/ext2.img bs=1M count=1 2> /dev/null +mkfs.ext2 -F -b 1024 images/ext2.img > /dev/null 2> /dev/null +dd if=/dev/zero of=images/vfat.img bs=1M count=1 2> /dev/null +mkfs.vfat images/vfat.img > /dev/null + +# Test mount it + +testing "mount vfat image (explicitly autodetect type)" \ + "mount -t auto images/vfat.img images/vfat.dir && mount | tail -n 1 | grep -o 'vfat.dir type vfat'" \ + "vfat.dir type vfat\n" "" "" +testing "mount ext2 image (autodetect type)" \ + "mount images/ext2.img images/ext2.dir 2> /dev/null && mount | tail -n 1" \ + "/dev/loop1 on /images/ext2.dir type ext2 (rw)\n" "" "" +testing "mount remount ext2 image noatime" \ + "mount -o remount,noatime images/ext2.dir && mount | tail -n 1" \ + "/dev/loop1 on /images/ext2.dir type ext2 (rw,noatime)\n" "" "" +testing "mount remount ext2 image ro remembers noatime" \ + "mount -o remount,ro images/ext2.dir && mount | tail -n 1" \ + "/dev/loop1 on /images/ext2.dir type ext2 (ro,noatime)\n" "" "" + +umount -d images/vfat.dir +umount -d images/ext2.dir + +testing "mount umount freed loop device" \ + "mount images/ext2.img images/ext2.dir && mount | tail -n 1" \ + "/dev/loop0 on /images/ext2.dir type ext2 (rw)\n" "" "" + +testing "mount block device" \ + "mount -t ext2 /dev/loop0 images/test1 && mount | tail -n 1" \ + "/dev/loop0 on /images/test1 type ext2 (rw)\n" "" "" + +umount -d images/ext2.dir images/test1 + +testing "mount remount nonexistent directory" \ + "mount -o remount,noatime images/ext2.dir 2> /dev/null || echo yes" \ + "yes\n" "" "" + +# Fun with mount -a + +testing "mount -a no fstab" "mount -a 2>/dev/null || echo yes" "yes\n" "" "" + +umount /proc + +# The first field is space delimited, the rest tabs. + +cat > /etc/fstab << FSTAB +/proc /proc proc defaults 0 0 +# Autodetect loop, and provide flags with commas in them. +/images/ext2.img /images/ext2.dir ext2 noatime,nodev 0 0 +# autodetect filesystem, flags without commas. +/images/vfat.img /images/vfat.dir auto ro 0 0 +# A block device +/dev/loop2 /images/test1 auto defaults 0 0 +# tmpfs, filesystem specific flag. +walrus /images/test2 tmpfs size=42 0 0 +# Autodetect a bind mount. +/images/test2 /images/test3 auto defaults 0 0 +FSTAB + +# Put something on loop2. +mknod /dev/loop2 b 7 2 +cat images/ext2.img > images/ext2-2.img +losetup /dev/loop2 images/ext2-2.img + +testing "mount -a" "mount -a && echo hello > /images/test2/abc && cat /images/test3/abc && (mount | wc -l)" "hello\n8\n" "" "" + +testing "umount -a" "umount -a && ls /proc" "" "" "" + +#/bin/bash < /dev/tty > /dev/tty 2> /dev/tty +mknod /dev/console c 5 1 +/bin/bash < /dev/console > /dev/console 2> /dev/console +EOF + +exit 0 + +# Run some tests + +losetup nonexistent device (should return error 2) +losetup unbound loop device (should return error 1) +losetup bind file to loop device +losetup bound loop device (display) (should return error 0) +losetup filename (error) +losetup nofile (file not found) +losetup -d +losetup bind with offset +losetup -f (print first loop device) +losetup -f filename (associate file with first loop device) +losetup -o (past end of file) -f filename + +mount -a + with multiple entries in fstab + with duplicate entries in fstab + with relative paths in fstab + with user entries in fstab +mount -o async,sync,atime,noatime,dev,nodev,exec,noexec,loop,suid,nosuid,remount,ro,rw,bind,move +mount -r +mount -o rw -r +mount -w -o ro +mount -t auto + +mount with relative path in fstab +mount block device +mount char device +mount file (autoloop) +mount directory (autobind) + + +testing "umount with no /proc" +testing "umount curdir" + +# The basic tests. These should work even with the small busybox. + +testing "sort" "input" "a\nb\nc\n" "c\na\nb\n" "" +testing "sort #2" "input" "010\n1\n3\n" "3\n1\n010\n" "" +testing "sort stdin" "" "a\nb\nc\n" "" "b\na\nc\n" +testing "sort numeric" "-n input" "1\n3\n010\n" "3\n1\n010\n" "" +testing "sort reverse" "-r input" "wook\nwalrus\npoint\npabst\naargh\n" \ + "point\nwook\npabst\naargh\nwalrus\n" "" + +optional FEATURE_MOUNT_LOOP +testing "umount -D" + +optional FEATURE_MTAB_SUPPORT +optional FEATURE_MOUNT_NFS +# No idea what to test here. + +optional UMOUNT +optional FEATURE_UMOUNT_ALL +testing "umount -a" +testing "umount -r" +testing "umount -l" +testing "umount -f" + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/mount.tests b/release/src/router/busybox/testsuite/mount.tests new file mode 100755 index 00000000..5374ecbd --- /dev/null +++ b/release/src/router/busybox/testsuite/mount.tests @@ -0,0 +1,35 @@ +#!/bin/sh + +# Copyright 2007 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +test "`id -u`" = 0 || { + echo "SKIPPED: must be root to test this" + exit 0 +} + +dd if=/dev/zero of=mount.image1m count=1 bs=1M 2>/dev/null || exit 1 +mkfs.minix -v mount.image1m >/dev/null 2>&1 || exit 1 +testdir=$PWD/testdir +mkdir $testdir 2>/dev/null +umount -d $testdir 2>/dev/null + +# testing "test name" "command" "expected result" "file input" "stdin" +# file input will be file called "input" +# test can create a file "actual" instead of writing to stdout + +testing "mount -o remount,mand" \ +"mount -o loop mount.image1m $testdir "\ +"&& grep -Fc $testdir file1 +echo file number two > file2 +ln -s file2 link1 +mkdir dir1 +touch --date='Sat Jan 29 21:24:08 PST 2000' dir1/file3 +mkdir there +busybox mv file1 file2 link1 dir1 there +test -f there/file1 +test -f there/file2 +test -f there/dir1/file3 +test -L there/link1 +test xfile2 = x`readlink there/link1` +test ! -e file1 +test ! -e file2 +test ! -e link1 +test ! -e dir1/file3 diff --git a/release/src/router/busybox/testsuite/mv/mv-follows-links b/release/src/router/busybox/testsuite/mv/mv-follows-links new file mode 100644 index 00000000..1fb355b8 --- /dev/null +++ b/release/src/router/busybox/testsuite/mv/mv-follows-links @@ -0,0 +1,4 @@ +touch foo +ln -s foo bar +busybox mv bar baz +test -f baz diff --git a/release/src/router/busybox/testsuite/mv/mv-moves-empty-file b/release/src/router/busybox/testsuite/mv/mv-moves-empty-file new file mode 100644 index 00000000..48afca4d --- /dev/null +++ b/release/src/router/busybox/testsuite/mv/mv-moves-empty-file @@ -0,0 +1,4 @@ +touch foo +busybox mv foo bar +test ! -e foo +test -f bar diff --git a/release/src/router/busybox/testsuite/mv/mv-moves-file b/release/src/router/busybox/testsuite/mv/mv-moves-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/mv/mv-moves-hardlinks b/release/src/router/busybox/testsuite/mv/mv-moves-hardlinks new file mode 100644 index 00000000..eaa8215a --- /dev/null +++ b/release/src/router/busybox/testsuite/mv/mv-moves-hardlinks @@ -0,0 +1,4 @@ +touch foo +ln foo bar +busybox mv bar baz +test ! -f bar -a -f baz diff --git a/release/src/router/busybox/testsuite/mv/mv-moves-large-file b/release/src/router/busybox/testsuite/mv/mv-moves-large-file new file mode 100644 index 00000000..77d088ff --- /dev/null +++ b/release/src/router/busybox/testsuite/mv/mv-moves-large-file @@ -0,0 +1,4 @@ +dd if=/dev/zero of=foo seek=10k count=1 2>/dev/null +busybox mv foo bar +test ! -e foo +test -f bar diff --git a/release/src/router/busybox/testsuite/mv/mv-moves-small-file b/release/src/router/busybox/testsuite/mv/mv-moves-small-file new file mode 100644 index 00000000..065c7f1e --- /dev/null +++ b/release/src/router/busybox/testsuite/mv/mv-moves-small-file @@ -0,0 +1,4 @@ +echo I WANT > foo +busybox mv foo bar +test ! -e foo +test -f bar diff --git a/release/src/router/busybox/testsuite/mv/mv-moves-symlinks b/release/src/router/busybox/testsuite/mv/mv-moves-symlinks new file mode 100644 index 00000000..c413af07 --- /dev/null +++ b/release/src/router/busybox/testsuite/mv/mv-moves-symlinks @@ -0,0 +1,6 @@ +touch foo +ln -s foo bar +busybox mv bar baz +test -f foo +test ! -e bar +test -L baz diff --git a/release/src/router/busybox/testsuite/mv/mv-moves-unreadable-files b/release/src/router/busybox/testsuite/mv/mv-moves-unreadable-files new file mode 100644 index 00000000..bc9c3133 --- /dev/null +++ b/release/src/router/busybox/testsuite/mv/mv-moves-unreadable-files @@ -0,0 +1,5 @@ +touch foo +chmod a-r foo +busybox mv foo bar +test ! -e foo +test -f bar diff --git a/release/src/router/busybox/testsuite/mv/mv-preserves-hard-links b/release/src/router/busybox/testsuite/mv/mv-preserves-hard-links new file mode 100644 index 00000000..b3ba3aa2 --- /dev/null +++ b/release/src/router/busybox/testsuite/mv/mv-preserves-hard-links @@ -0,0 +1,6 @@ +# FEATURE: CONFIG_FEATURE_PRESERVE_HARDLINKS +touch foo +ln foo bar +mkdir baz +busybox mv foo bar baz +test baz/foo -ef baz/bar diff --git a/release/src/router/busybox/testsuite/mv/mv-preserves-links b/release/src/router/busybox/testsuite/mv/mv-preserves-links new file mode 100644 index 00000000..ea565d2f --- /dev/null +++ b/release/src/router/busybox/testsuite/mv/mv-preserves-links @@ -0,0 +1,5 @@ +touch foo +ln -s foo bar +busybox mv bar baz +test -L baz +test xfoo = x`readlink baz` diff --git a/release/src/router/busybox/testsuite/mv/mv-refuses-mv-dir-to-subdir b/release/src/router/busybox/testsuite/mv/mv-refuses-mv-dir-to-subdir new file mode 100644 index 00000000..7c572c4f --- /dev/null +++ b/release/src/router/busybox/testsuite/mv/mv-refuses-mv-dir-to-subdir @@ -0,0 +1,23 @@ +echo file number one > file1 +echo file number two > file2 +ln -s file2 link1 +mkdir dir1 +touch --date='Sat Jan 29 21:24:08 PST 2000' dir1/file3 +mkdir there +busybox mv file1 file2 link1 dir1 there +test -f there/file1 +test -f there/file2 +test -f there/dir1/file3 +test -L there/link1 +test xfile2 = x`readlink there/link1` +test ! -e file1 +test ! -e file2 +test ! -e link1 +test ! -e dir1/file3 +set +e +busybox mv there there/dir1 +if [ $? != 0 ] ; then + exit 0; +fi + +exit 1; diff --git a/release/src/router/busybox/testsuite/mv/mv-removes-source-file b/release/src/router/busybox/testsuite/mv/mv-removes-source-file new file mode 100644 index 00000000..48afca4d --- /dev/null +++ b/release/src/router/busybox/testsuite/mv/mv-removes-source-file @@ -0,0 +1,4 @@ +touch foo +busybox mv foo bar +test ! -e foo +test -f bar diff --git a/release/src/router/busybox/testsuite/od.tests b/release/src/router/busybox/testsuite/od.tests new file mode 100755 index 00000000..69c29952 --- /dev/null +++ b/release/src/router/busybox/testsuite/od.tests @@ -0,0 +1,17 @@ +#!/bin/sh +# Copyright 2008 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# testing "test name" "options" "expected result" "file input" "stdin" + +testing "od -b" \ + "od -b" \ +"\ +0000000 110 105 114 114 117 +0000006 +" \ + "" "HELLO" + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/parse.tests b/release/src/router/busybox/testsuite/parse.tests new file mode 100755 index 00000000..f1ee7b83 --- /dev/null +++ b/release/src/router/busybox/testsuite/parse.tests @@ -0,0 +1,109 @@ +#!/bin/sh + +# Copyright 2008 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +COLLAPSE=$(( 0x00010000)) +TRIM=$(( 0x00020000)) +GREEDY=$(( 0x00040000)) +MIN_DIE=$(( 0x00100000)) +KEEP_COPY=$((0x00200000)) +ESCAPE=$(( 0x00400000)) +NORMAL=$(( COLLAPSE | TRIM | GREEDY)) + +# testing "description" "command" "result" "infile" "stdin" + +testing "parse mdev.conf" \ + "parse -n 4 -m 3 -f $((NORMAL)) -" \ + "[sda][0:0][644][@echo @echo TEST]\n" \ + "-" \ + " sda 0:0 644 @echo @echo TEST # echo trap\n" + +testing "parse notrim" \ + "parse -n 4 -m 3 -f $((NORMAL - TRIM - COLLAPSE)) -" \ + "[][sda][0:0][644 @echo @echo TEST ]\n" \ + "-" \ + " sda 0:0 644 @echo @echo TEST \n" + +FILE=__parse +cat >$FILE <$FILE.res <$FILE.res <$FILE.res < /dev/null; echo \$?" \ + "0\n" "" "" +# We can get away with this because it says #!/bin/sh up top. + +testing "pidof this" "pidof pidof.tests | grep -o -w $$" "$$\n" "" "" + +optional FEATURE_PIDOF_SINGLE +testing "pidof -s" "pidof -s init" "1\n" "" "" + +optional FEATURE_PIDOF_OMIT +# This test fails now because process name matching logic has changed, +# but new logic is not "wrong" either... see find_pid_by_name.c comments +#testing "pidof -o %PPID" "pidof -o %PPID pidof.tests | grep -o -w $$" "" "" "" +testing "pidof -o %PPID NOP" "pidof -o %PPID -s init" "1\n" "" "" +testing "pidof -o init" "pidof -o 1 init | grep -o -w 1" "" "" "" + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/printf.tests b/release/src/router/busybox/testsuite/printf.tests new file mode 100755 index 00000000..f9d1deca --- /dev/null +++ b/release/src/router/busybox/testsuite/printf.tests @@ -0,0 +1,108 @@ +#!/bin/sh +# Copyright 2008 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# Need this in order to not execute shell builtin +bb="busybox " + +# testing "test name" "command" "expected result" "file input" "stdin" + +testing "printf produces no further output 1" \ + "${bb}printf '\c' foo" \ + "" \ + "" "" + +testing "printf produces no further output 2" \ + "${bb}printf '%s\c' foo bar" \ + "foo" \ + "" "" + +testing "printf repeatedly uses pattern for each argv" \ + "${bb}printf '%s\n' foo \$HOME" \ + "foo\n$HOME\n" \ + "" "" + +testing "printf understands %b escaped_string" \ + "${bb}printf '%b' 'a\tb' 'c\\d\n' 2>&1; echo \$?" \ + "a\tbc\\d\n""0\n" \ + "" "" + +testing "printf understands %d '\"x' \"'y\" \"'zTAIL\"" \ + "${bb}printf '%d\n' '\"x' \"'y\" \"'zTAIL\" 2>&1; echo \$?" \ + "120\n""121\n""122\n""0\n" \ + "" "" + +testing "printf understands %s '\"x' \"'y\" \"'zTAIL\"" \ + "${bb}printf '%s\n' '\"x' \"'y\" \"'zTAIL\" 2>&1; echo \$?" \ + "\"x\n""'y\n""'zTAIL\n""0\n" \ + "" "" + +testing "printf understands %23.12f" \ + "${bb}printf '|%23.12f|\n' 5.25 2>&1; echo \$?" \ + "| 5.250000000000|\n""0\n" \ + "" "" + +testing "printf understands %*.*f" \ + "${bb}printf '|%*.*f|\n' 23 12 5.25 2>&1; echo \$?" \ + "| 5.250000000000|\n""0\n" \ + "" "" + +testing "printf understands %*f with negative width" \ + "${bb}printf '|%*f|\n' -23 5.25 2>&1; echo \$?" \ + "|5.250000 |\n""0\n" \ + "" "" + +testing "printf understands %.*f with negative precision" \ + "${bb}printf '|%.*f|\n' -12 5.25 2>&1; echo \$?" \ + "|5.250000|\n""0\n" \ + "" "" + +testing "printf understands %*.*f with negative width/precision" \ + "${bb}printf '|%*.*f|\n' -23 -12 5.25 2>&1; echo \$?" \ + "|5.250000 |\n""0\n" \ + "" "" + +testing "printf understands %zd" \ + "${bb}printf '%zd\n' -5 2>&1; echo \$?" \ + "-5\n""0\n" \ + "" "" + +testing "printf understands %ld" \ + "${bb}printf '%ld\n' -5 2>&1; echo \$?" \ + "-5\n""0\n" \ + "" "" + +testing "printf understands %Ld" \ + "${bb}printf '%Ld\n' -5 2>&1; echo \$?" \ + "-5\n""0\n" \ + "" "" + +# We are "more correct" here than bash/coreutils: they happily print -2 +# as if it is a huge unsigned number +testing "printf handles %u -N" \ + "${bb}printf '%u\n' 1 -2 3 2>&1; echo \$?" \ + "1\n""printf: -2: invalid number\n""0\n""3\n""0\n" \ + "" "" + +# Actually, we are wrong here: exit code should be 1 +testing "printf handles %d bad_input" \ + "${bb}printf '%d\n' 1 - 2 bad 3 123bad 4 2>&1; echo \$?" \ +"1\n""printf: -: invalid number\n""0\n"\ +"2\n""printf: bad: invalid number\n""0\n"\ +"3\n""printf: 123bad: invalid number\n""0\n"\ +"4\n""0\n" \ + "" "" + +testing "printf aborts on bare %" \ + "${bb}printf '%' a b c 2>&1; echo \$?" \ + "printf: %: invalid format\n""1\n" \ + "" "" + +testing "printf aborts on %r" \ + "${bb}printf '%r' a b c 2>&1; echo \$?" \ + "printf: %r: invalid format\n""1\n" \ + "" "" + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/pwd/pwd-prints-working-directory b/release/src/router/busybox/testsuite/pwd/pwd-prints-working-directory old mode 100755 new mode 100644 index 7bea1074..8575347d --- a/release/src/router/busybox/testsuite/pwd/pwd-prints-working-directory +++ b/release/src/router/busybox/testsuite/pwd/pwd-prints-working-directory @@ -1 +1 @@ -test `pwd` = `busybox pwd` +test $(pwd) = $(busybox pwd) diff --git a/release/src/router/busybox/testsuite/readlink.tests b/release/src/router/busybox/testsuite/readlink.tests new file mode 100755 index 00000000..0faa6ed0 --- /dev/null +++ b/release/src/router/busybox/testsuite/readlink.tests @@ -0,0 +1,32 @@ +#!/bin/sh + +# Readlink tests. +# Copyright 2006 by Natanael Copa +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +TESTDIR=readlink_testdir +TESTFILE="$TESTDIR/testfile" +TESTLINK="testlink" +FAILLINK="$TESTDIR/$TESTDIR/testlink" + +# create the dir and test files +mkdir -p "./$TESTDIR" +touch "./$TESTFILE" +ln -s "./$TESTFILE" "./$TESTLINK" + +testing "readlink on a file" "readlink ./$TESTFILE" "" "" "" +testing "readlink on a link" "readlink ./$TESTLINK" "./$TESTFILE\n" "" "" + +optional FEATURE_READLINK_FOLLOW + +testing "readlink -f on a file" "readlink -f ./$TESTFILE" "$PWD/$TESTFILE\n" "" "" +testing "readlink -f on a link" "readlink -f ./$TESTLINK" "$PWD/$TESTFILE\n" "" "" +testing "readlink -f on an invalid link" "readlink -f ./$FAILLINK" "" "" "" +testing "readlink -f on a wierd dir" "readlink -f $TESTDIR/../$TESTFILE" "$PWD/$TESTFILE\n" "" "" + + +# clean up +rm -r "$TESTLINK" "$TESTDIR" + diff --git a/release/src/router/busybox/testsuite/rm/rm-removes-file b/release/src/router/busybox/testsuite/rm/rm-removes-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/rmdir/rmdir-removes-parent-directories b/release/src/router/busybox/testsuite/rmdir/rmdir-removes-parent-directories old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/runtest b/release/src/router/busybox/testsuite/runtest index 2cf85f5d..cade871a 100755 --- a/release/src/router/busybox/testsuite/runtest +++ b/release/src/router/busybox/testsuite/runtest @@ -1,113 +1,164 @@ #!/bin/sh -PATH=$(dirname $(pwd)):$PATH - -show_result () -{ - local resolution=$1 - local testcase=$2 - local status=0 - - if [ $resolution = XPASS -o $resolution = FAIL ]; then - status=1 - fi - - if [ "$verbose" -o $status -eq 1 ]; then - echo "$resolution: $testcase" - fi - - return $status +# Usage: +# runtest [applet1] [applet2...] + +# Helper for helpers. Oh my... +test x"$ECHO" != x"" || { + ECHO="echo" + test x"`echo -ne`" = x"" || { + # Compile and use a replacement 'echo' which understands -e -n + ECHO="$PWD/echo-ne" + test -x "$ECHO" || { + gcc -Os -o "$ECHO" ../scripts/echo.c || exit 1 + } + } + export ECHO } -run_applet_testcase () +# Run one old-style test. +# Tests are stored in applet/testcase shell scripts. +# They are run using "sh -x -e applet/testcase". +# Option -e will make testcase stop on the first failed command. +run_applet_testcase() { - local applet=$1 - local testcase=$2 + local applet="$1" + local testcase="$2" local status=0 - local X= + local uc_applet=$(echo "$applet" | tr a-z A-Z) + local testname="$testcase" - local uc_applet=$(echo $applet | tr a-z A-Z) - local testname=$(basename $testcase) - - if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then - show_result UNTESTED $testname + testname="${testname##*/}" # take basename + if grep "^# CONFIG_$uc_applet is not set$" "$bindir/.config" >/dev/null; then + echo "UNTESTED: $testname" return 0 fi - if grep -q "^# FEATURE: " $testcase; then - local feature=`sed -ne 's/^# FEATURE: //p' $testcase` + if grep "^# FEATURE: " "$testcase" >/dev/null; then + local feature=$(sed -ne 's/^# FEATURE: //p' "$testcase") - if grep -q "^# ${feature} is not set$" ../.config; then - show_result UNTESTED $testname + if grep "^# $feature is not set$" "$bindir/.config" >/dev/null; then + echo "UNTESTED: $testname" return 0 fi fi - if grep -q "^# XFAIL$" $testcase; then - X=X - fi - - mkdir tmp - pushd tmp >/dev/null - - if . ../$testcase >/dev/null 2>&1; then - show_result ${X}PASS $testname - status=$? + rm -rf ".tmpdir.$applet" + mkdir -p ".tmpdir.$applet" + cd ".tmpdir.$applet" || return 1 + +# echo "Running testcase $testcase" + d="$tsdir" \ + sh -x -e "$testcase" >"$testname.stdout.txt" 2>&1 || status=$? + if [ $status -ne 0 ]; then + echo "FAIL: $testname" + if [ x"$VERBOSE" != x ]; then + cat "$testname.stdout.txt" + fi else - show_result ${X}FAIL $testname - status=$? + echo "PASS: $testname" fi - popd >/dev/null - rm -rf tmp + cd .. + rm -rf ".tmpdir.$applet" return $status } -run_applet_tests () +# Run all old-style tests for given applet +run_oldstyle_applet_tests() { - local applet=$1 - + local applet="$1" local status=0 - for testcase in $applet/*; do - if [ "$testcase" = "$applet/CVS" ]; then - continue - fi - - if run_applet_testcase $applet $testcase; then - : - else - status=1 - fi + for testcase in "$tsdir/$applet"/*; do + # switch on basename of $testcase + case "${testcase##*/}" in + .*) continue ;; # .svn, .git etc + *~) continue ;; # backup files + "CVS") continue ;; + \#*) continue ;; # CVS merge residues + *.mine) continue ;; # svn-produced junk + *.r[0-9]*) continue ;; # svn-produced junk + esac + run_applet_testcase "$applet" "$testcase" || status=1 done - return $status } -status=0 + +lcwd=$(pwd) +[ x"$tsdir" != x ] || tsdir="$lcwd" +[ x"$bindir" != x ] || bindir="${lcwd%/*}" # one directory up from $lcwd +PATH="$bindir:$PATH" + +if [ x"$VERBOSE" = x ]; then + export VERBOSE= +fi if [ x"$1" = x"-v" ]; then - verbose=1 + export VERBOSE=1 shift fi +implemented=$( + "$bindir/busybox" 2>&1 | + while read line; do + if [ x"$line" = x"Currently defined functions:" ]; then + xargs | sed 's/,//g' + break + fi + done + ) + +applets="$implemented" if [ $# -ne 0 ]; then applets="$@" -else - applets="*" fi +# Populate a directory with links to all busybox applets + +LINKSDIR="$bindir/runtest-tempdir-links" +rm -rf "$LINKSDIR" 2>/dev/null +mkdir "$LINKSDIR" +for i in $implemented; do + ln -s "$bindir/busybox" "$LINKSDIR/$i" +done + +# Set up option flags so tests can be selective. +export OPTIONFLAGS=:$( + sed -nr 's/^CONFIG_//p' "$bindir/.config" | + sed 's/=.*//' | xargs | sed 's/ /:/g' + ) + +status=0 for applet in $applets; do - if [ "$applet" != CVS -a -d "$applet" ]; then - if run_applet_tests $applet; then - : - else - status=1 + # Any old-style tests for this applet? + if [ -d "$tsdir/$applet" ]; then + run_oldstyle_applet_tests "$applet" || status=1 + fi + + # Is this a new-style test? + if [ -f "$applet.tests" ]; then + if [ ! -h "$LINKSDIR/$applet" ]; then + # (avoiding bash'ism "${applet:0:4}") + if ! echo "$applet" | grep "^all_" >/dev/null; then + echo "SKIPPED: $applet (not built)" + continue + fi fi +# echo "Running test $tsdir/$applet.tests" + PATH="$LINKSDIR:$tsdir:$bindir:$PATH" \ + "$tsdir/$applet.tests" || status=1 fi done +# Leaving the dir makes it somewhat easier to run failed test by hand +#rm -rf "$LINKSDIR" + +if [ $status -ne 0 ] && [ x"$VERBOSE" = x ]; then + echo "Failures detected, running with -v (verbose) will give more info" +fi exit $status diff --git a/release/src/router/busybox/testsuite/sed.tests b/release/src/router/busybox/testsuite/sed.tests new file mode 100755 index 00000000..9a7f886c --- /dev/null +++ b/release/src/router/busybox/testsuite/sed.tests @@ -0,0 +1,210 @@ +#!/bin/sh + +# SUSv3 compliant sed tests. +# Copyright 2005 by Rob Landley +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# testing "description" "arguments" "result" "infile" "stdin" + +# Corner cases +testing "sed no files (stdin)" 'sed ""' "hello\n" "" "hello\n" +testing "sed explicit stdin" 'sed "" -' "hello\n" "" "hello\n" +testing "sed handles empty lines" "sed -e 's/\$/@/'" "@\n" "" "\n" +testing "sed stdin twice" 'sed "" - -' "hello" "" "hello" + +# Trailing EOF. +# Match $, at end of each file or all files? + +# -e corner cases +# without -e +# multiple -e +# interact with a +# -eee arg1 arg2 arg3 +# -f corner cases +# -e -f -e +# -n corner cases +# no newline at EOF? +# -r corner cases +# Just make sure it works. +# -i corner cases: +# sed -i - +# permissions +# -i on a symlink +# on a directory +# With $ last-line test +# Continue with \ +# End of script with trailing \ + +# command list +testing "sed accepts blanks before command" "sed -e '1 d'" "" "" "" +testing "sed accepts newlines in -e" "sed -e 'i\ +1 +a\ +3'" "1\n2\n3\n" "" "2\n" +testing "sed accepts multiple -e" "sed -e 'i\' -e '1' -e 'a\' -e '3'" \ + "1\n2\n3\n" "" "2\n" + +# substitutions +testing "sed -n" "sed -n -e s/foo/bar/ -e s/bar/baz/" "" "" "foo\n" +testing "sed s//p" "sed -e s/foo/bar/p -e s/bar/baz/p" "bar\nbaz\nbaz\n" \ + "" "foo\n" +testing "sed -n s//p" "sed -ne s/abc/def/p" "def\n" "" "abc\n" +testing "sed s//g (exhaustive)" "sed -e 's/[[:space:]]*/,/g'" ",1,2,3,4,5,\n" \ + "" "12345\n" +testing "sed s arbitrary delimiter" "sed -e 's woo boing '" "boing\n" "" "woo\n" +testing "sed s chains" "sed -e s/foo/bar/ -e s/bar/baz/" "baz\n" "" "foo\n" +testing "sed s chains2" "sed -e s/foo/bar/ -e s/baz/nee/" "bar\n" "" "foo\n" +testing "sed s [delimiter]" "sed -e 's@[@]@@'" "onetwo" "" "one@two" +testing "sed s with \\t (GNU ext)" "sed 's/\t/ /'" "one two" "" "one\ttwo" + +# branch +testing "sed b (branch)" "sed -e 'b one;p;: one'" "foo\n" "" "foo\n" +testing "sed b (branch with no label jumps to end)" "sed -e 'b;p'" \ + "foo\n" "" "foo\n" + +# test and branch +testing "sed t (test/branch)" "sed -e 's/a/1/;t one;p;: one;p'" \ + "1\n1\nb\nb\nb\nc\nc\nc\n" "" "a\nb\nc\n" +testing "sed t (test/branch clears test bit)" "sed -e 's/a/b/;:loop;t loop'" \ + "b\nb\nc\n" "" "a\nb\nc\n" +testing "sed T (!test/branch)" "sed -e 's/a/1/;T notone;p;: notone;p'" \ + "1\n1\n1\nb\nb\nc\nc\n" "" "a\nb\nc\n" + +# Normal sed end-of-script doesn't print "c" because n flushed the pattern +# space. If n hits EOF, pattern space is empty when script ends. +# Query: how does this interact with no newline at EOF? +testing "sed n (flushes pattern space, terminates early)" "sed -e 'n;p'" \ + "a\nb\nb\nc\n" "" "a\nb\nc\n" +# N does _not_ flush pattern space, therefore c is still in there @ script end. +testing "sed N (doesn't flush pattern space when terminating)" "sed -e 'N;p'" \ + "a\nb\na\nb\nc\n" "" "a\nb\nc\n" +testing "sed address match newline" 'sed "/b/N;/b\\nc/i woo"' \ + "a\nwoo\nb\nc\nd\n" "" "a\nb\nc\nd\n" + +# Multiple lines in pattern space +testing "sed N (stops at end of input) and P (prints to first newline only)" \ + "sed -n 'N;P;p'" "a\na\nb\n" "" "a\nb\nc\n" + +# Hold space +testing "sed G (append hold space to pattern space)" 'sed G' "a\n\nb\n\nc\n\n" \ + "" "a\nb\nc\n" +#testing "sed g/G (swap/append hold and patter space)" +#testing "sed g (swap hold/pattern space)" + +testing "sed d ends script iteration" \ + "sed -e '/ook/d;s/ook/ping/p;i woot'" "" "" "ook\n" +testing "sed d ends script iteration (2)" \ + "sed -e '/ook/d;a\' -e 'bang'" "woot\nbang\n" "" "ook\nwoot\n" + +# Multiple files, with varying newlines and NUL bytes +testing "sed embedded NUL" "sed -e 's/woo/bang/'" "\0bang\0woo\0" "" \ + "\0woo\0woo\0" +testing "sed embedded NUL g" "sed -e 's/woo/bang/g'" "bang\0bang\0" "" \ + "woo\0woo\0" +echo -e "/woo/a he\0llo" > sed.commands +testing "sed NUL in command" "sed -f sed.commands" "woo\nhe\0llo\n" "" "woo" +rm sed.commands + +# sed has funky behavior with newlines at the end of file. Test lots of +# corner cases with the optional newline appending behavior. + +testing "sed normal newlines" "sed -e 's/woo/bang/' input -" "bang\nbang\n" \ + "woo\n" "woo\n" +testing "sed leave off trailing newline" "sed -e 's/woo/bang/' input -" \ + "bang\nbang" "woo\n" "woo" +testing "sed autoinsert newline" "sed -e 's/woo/bang/' input -" "bang\nbang" \ + "woo" "woo" +testing "sed empty file plus cat" "sed -e 's/nohit//' input -" "one\ntwo" \ + "" "one\ntwo" +testing "sed cat plus empty file" "sed -e 's/nohit//' input -" "one\ntwo" \ + "one\ntwo" "" +testing "sed append autoinserts newline" "sed -e '/woot/a woo' -" \ + "woot\nwoo\n" "" "woot" +testing "sed insert doesn't autoinsert newline" "sed -e '/woot/i woo' -" \ + "woo\nwoot" "" "woot" +testing "sed print autoinsert newlines" "sed -e 'p' -" "one\none" "" "one" +testing "sed print autoinsert newlines two files" "sed -e 'p' input -" \ + "one\none\ntwo\ntwo" "one" "two" +testing "sed noprint, no match, no newline" "sed -ne 's/woo/bang/' input" \ + "" "no\n" "" +testing "sed selective matches with one nl" "sed -ne 's/woo/bang/p' input -" \ + "a bang\nc bang\n" "a woo\nb no" "c woo\nd no" +testing "sed selective matches insert newline" \ + "sed -ne 's/woo/bang/p' input -" "a bang\nb bang\nd bang" \ + "a woo\nb woo" "c no\nd woo" +testing "sed selective matches noinsert newline" \ + "sed -ne 's/woo/bang/p' input -" "a bang\nb bang" "a woo\nb woo" \ + "c no\nd no" +testing "sed clusternewline" \ + "sed -e '/one/a 111' -e '/two/i 222' -e p input -" \ + "one\none\n111\n222\ntwo\ntwo" "one" "two" +testing "sed subst+write" \ + "sed -e 's/i/z/' -e 'woutputw' input -; echo -n X; cat outputw" \ + "thzngy\nagaznXthzngy\nagazn" "thingy" "again" +rm outputw +testing "sed trailing NUL" \ + "sed 's/i/z/' input -" \ + "a\0b\0\nc" "a\0b\0" "c" +testing "sed escaped newline in command" \ + "sed 's/a/z\\ +z/' input" \ + "z\nz" "a" "" + +# Test end-of-file matching behavior + +testing "sed match EOF" "sed -e '"'$p'"'" "hello\nthere\nthere" "" \ + "hello\nthere" +testing "sed match EOF two files" "sed -e '"'$p'"' input -" \ + "one\ntwo\nthree\nfour\nfour" "one\ntwo" "three\nfour" +# sed match EOF inline: gnu sed 4.1.5 outputs this: +#00000000 6f 6e 65 0a 6f 6f 6b 0a 6f 6f 6b 0a 74 77 6f 0a |one.ook.ook.two.| +#00000010 0a 74 68 72 65 65 0a 6f 6f 6b 0a 6f 6f 6b 0a 66 |.three.ook.ook.f| +#00000020 6f 75 72 |our| +# which looks buggy to me. +$ECHO -ne "three\nfour" > input2 +testing "sed match EOF inline" \ + "sed -e '"'$i ook'"' -i input input2 && cat input input2" \ + "one\nook\ntwothree\nook\nfour" "one\ntwo" "" +rm input2 + +# Test lie-to-autoconf + +testing "sed lie-to-autoconf" "sed --version | grep -o 'GNU sed version '" \ + "GNU sed version \n" "" "" + +# Jump to nonexistent label +testing "sed nonexistent label" "sed -e 'b walrus' 2> /dev/null || echo yes" \ + "yes\n" "" "" + +testing "sed backref from empty s uses range regex" \ + "sed -e '/woot/s//eep \0 eep/'" "eep woot eep" "" "woot" + +testing "sed backref from empty s uses range regex with newline" \ + "sed -e '/woot/s//eep \0 eep/'" "eep woot eep\n" "" "woot\n" + +# -i with no filename + +touch ./- # Detect gnu failure mode here. +testing "sed -i with no arg [GNUFAIL]" "sed -e '' -i 2> /dev/null || echo yes" \ + "yes\n" "" "" +rm ./- # Clean up + +testing "sed s/xxx/[/" "sed -e 's/xxx/[/'" "[\n" "" "xxx\n" + +# Ponder this a bit more, why "woo not found" from gnu version? +#testing "sed doesn't substitute in deleted line" \ +# "sed -e '/ook/d;s/ook//;t woo;a bang;'" "bang" "" "ook\n" + +# This makes both seds very unhappy. Why? +#testing "sed -g (exhaustive)" "sed -e 's/[[:space:]]*/,/g'" ",1,2,3,4,5," \ +# "" "12345" + +# testing "description" "arguments" "result" "infile" "stdin" + +testing "sed n command must reset 'substituted' bit" \ + "sed 's/1/x/;T;n;: next;s/3/y/;t quit;n;b next;: quit;q'" \ + "0\nx\n2\ny\n" "" "0\n1\n2\n3\n" + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/sed/sed-accepts-blanks-before-command b/release/src/router/busybox/testsuite/sed/sed-accepts-blanks-before-command deleted file mode 100755 index 9597c2f8..00000000 --- a/release/src/router/busybox/testsuite/sed/sed-accepts-blanks-before-command +++ /dev/null @@ -1 +0,0 @@ -busybox sed -e '1 d' input <output <foo -cmp foo /dev/null diff --git a/release/src/router/busybox/testsuite/sed/sed-handles-embedded-slashes b/release/src/router/busybox/testsuite/sed/sed-handles-embedded-slashes deleted file mode 100755 index cc287613..00000000 --- a/release/src/router/busybox/testsuite/sed/sed-handles-embedded-slashes +++ /dev/null @@ -1 +0,0 @@ -test "$(echo fu/bar | busybox sed -e 's/[/]//')" = fubar diff --git a/release/src/router/busybox/testsuite/sed/sed-handles-empty-lines b/release/src/router/busybox/testsuite/sed/sed-handles-empty-lines deleted file mode 100755 index 2bb8f045..00000000 --- a/release/src/router/busybox/testsuite/sed/sed-handles-empty-lines +++ /dev/null @@ -1 +0,0 @@ -test `echo | busybox sed -e 's/$/@/'` = @ diff --git a/release/src/router/busybox/testsuite/sed/sed-handles-unsatisfied-backrefs b/release/src/router/busybox/testsuite/sed/sed-handles-unsatisfied-backrefs deleted file mode 100755 index 61bff883..00000000 --- a/release/src/router/busybox/testsuite/sed/sed-handles-unsatisfied-backrefs +++ /dev/null @@ -1,6 +0,0 @@ -busybox sed -e 's/.*root=/\1/' >output <output < output -cmp output - < +# Licensed under GPL v2, see file LICENSE for details. + +# AUDIT: Full SUSv3 coverage (except internationalization). + +. testing.sh + +# testing "test name" "options" "expected result" "file input" "stdin" +# file input will be file called "input" +# test can create a file "actual" instead of writing to stdout + +# Test exit status + +testing "seq (exit with error)" "seq 2> /dev/null || echo yes" "yes\n" "" "" +testing "seq (exit with error)" "seq 1 2 3 4 2> /dev/null || echo yes" \ + "yes\n" "" "" +testing "seq one argument" "seq 3" "1\n2\n3\n" "" "" +testing "seq two arguments" "seq 5 7" "5\n6\n7\n" "" "" +testing "seq two arguments reversed" "seq 7 5" "" "" "" +testing "seq two arguments equal" "seq 3 3" "3\n" "" "" +testing "seq two arguments equal, arbitrary negative step" "seq 1 -15 1" \ + "1\n" "" "" +testing "seq two arguments equal, arbitrary positive step" "seq 1 +15 1" \ + "1\n" "" "" +testing "seq count up by 2" "seq 4 2 8" "4\n6\n8\n" "" "" +testing "seq count down by 2" "seq 8 -2 4" "8\n6\n4\n" "" "" +testing "seq count wrong way #1" "seq 4 -2 8" "" "" "" +testing "seq count wrong way #2" "seq 8 2 4" "" "" "" +testing "seq count by .3" "seq 3 .3 4" "3.0\n3.3\n3.6\n3.9\n" "" "" +testing "seq count by -.9" "seq .7 -.9 -2.2" "0.7\n-0.2\n-1.1\n-2\n" "" "" +testing "seq count by zero" "seq 4 0 8 | head -n 10" "" "" "" + +testing "seq one argument with padding" "seq -w 003" "001\n002\n003\n" "" "" +testing "seq two arguments with padding" "seq -w 005 7" "005\n006\n007\n" "" "" +testing "seq count down by 3 with padding" "seq -w 8 -3 04" "08\n05\n" "" "" +testing "seq count by .3 with padding" "seq -w 03 .3 0004" "003.0\n003.3\n003.6\n003.9\n" "" "" + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/sort.tests b/release/src/router/busybox/testsuite/sort.tests new file mode 100755 index 00000000..f700dc0c --- /dev/null +++ b/release/src/router/busybox/testsuite/sort.tests @@ -0,0 +1,119 @@ +#!/bin/bash + +# SUSv3 compliant sort tests. +# Copyright 2005 by Rob Landley +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# The basic tests. These should work even with the small busybox. + +testing "sort" "sort input" "a\nb\nc\n" "c\na\nb\n" "" +testing "sort #2" "sort input" "010\n1\n3\n" "3\n1\n010\n" "" +testing "sort stdin" "sort" "a\nb\nc\n" "" "b\na\nc\n" +testing "sort numeric" "sort -n input" "1\n3\n010\n" "3\n1\n010\n" "" +testing "sort reverse" "sort -r input" "wook\nwalrus\npoint\npabst\naargh\n" \ + "point\nwook\npabst\naargh\nwalrus\n" "" + +# These tests require the full option set. + +optional FEATURE_SORT_BIG +# Longish chunk of data re-used by the next few tests + +data="42 1 3 woot +42 1 010 zoology +egg 1 2 papyrus +7 3 42 soup +999 3 0 algebra +" + +# Sorting with keys + +testing "sort one key" "sort -k4,4 input" \ +"999 3 0 algebra +egg 1 2 papyrus +7 3 42 soup +42 1 3 woot +42 1 010 zoology +" "$data" "" + +testing "sort key range with numeric option" "sort -k2,3n input" \ +"42 1 010 zoology +42 1 3 woot +egg 1 2 papyrus +7 3 42 soup +999 3 0 algebra +" "$data" "" + +# Busybox is definitely doing this one wrong just now. FIXME + +testing "sort key range with numeric option and global reverse" \ +"sort -k2,3n -r input" \ +"egg 1 2 papyrus +42 1 3 woot +42 1 010 zoology +999 3 0 algebra +7 3 42 soup +" "$data" "" + +# + +testing "sort key range with multiple options" "sort -k2,3rn input" \ +"7 3 42 soup +999 3 0 algebra +42 1 010 zoology +42 1 3 woot +egg 1 2 papyrus +" "$data" "" + +testing "sort key range with two -k options" "sort -k 2,2n -k 1,1r input" "\ +d 2 +b 2 +c 3 +" "\ +c 3 +b 2 +d 2 +" "" + +testing "sort with non-default leading delim 1" "sort -n -k2 -t/ input" "\ +/a/2 +/b/1 +" "\ +/a/2 +/b/1 +" "" + +testing "sort with non-default leading delim 2" "sort -n -k3 -t/ input" "\ +/b/1 +/a/2 +" "\ +/b/1 +/a/2 +" "" + +testing "sort with non-default leading delim 3" "sort -n -k3 -t/ input" "\ +//a/2 +//b/1 +" "\ +//a/2 +//b/1 +" "" + +testing "sort -u should consider field only when discarding" "sort -u -k2 input" "\ +a c +" "\ +a c +b c +" "" + +testing "sort -z outputs NUL terminated lines" "sort -z input" "\ +one\0three\0two\0\ +" "\ +one\0two\0three\0\ +" "" + +testing "sort key doesn't strip leading blanks, disables fallback global sort" \ +"sort -n -k2 -t ' '" " a \n 1 \n 2 \n" "" " 2 \n 1 \n a \n" + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/start-stop-daemon.tests b/release/src/router/busybox/testsuite/start-stop-daemon.tests new file mode 100755 index 00000000..ba77cde6 --- /dev/null +++ b/release/src/router/busybox/testsuite/start-stop-daemon.tests @@ -0,0 +1,19 @@ +#!/bin/sh +# Copyright 2008 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# testing "test name" "cmd" "expected result" "file input" "stdin" + +testing "start-stop-daemon -x without -a" \ + 'start-stop-daemon -S -x true 2>&1; echo $?' \ + "0\n" \ + "" "" + +testing "start-stop-daemon -a without -x" \ + 'start-stop-daemon -S -a false 2>&1; echo $?' \ + "1\n" \ + "" "" + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/strings/strings-works-like-GNU b/release/src/router/busybox/testsuite/strings/strings-works-like-GNU old mode 100755 new mode 100644 index 02e42313..2d647103 --- a/release/src/router/busybox/testsuite/strings/strings-works-like-GNU +++ b/release/src/router/busybox/testsuite/strings/strings-works-like-GNU @@ -1,8 +1,9 @@ rm -f foo bar strings -af ../../busybox > foo busybox strings -af ../../busybox > bar +set +e test ! -f foo -a -f bar if [ $? = 0 ] ; then - diff -q foo bar -fi; - + set -e + diff -q foo bar +fi diff --git a/release/src/router/busybox/testsuite/sum.tests b/release/src/router/busybox/testsuite/sum.tests new file mode 100755 index 00000000..e537cf60 --- /dev/null +++ b/release/src/router/busybox/testsuite/sum.tests @@ -0,0 +1,24 @@ +#!/bin/sh + +# unit test for sum. +# Copyright 2007 by Bernhard Reutner-Fischer +# Licensed under GPL v2 or later, see file LICENSE for details. + +# AUDIT: Unit tests for sum + +. testing.sh + +# testing "test name" "options" "expected result" "file input" "stdin" +# file input will be file called "input" +# test can create a file "actual" instead of writing to stdout + +testing "sum -r file doesn't print file's name" \ + "sum -r $0 | grep -c $0 && echo wrongly_printed_filename || echo yes" \ + "0\nyes\n" "" "" +testing "sum -r file file does print both names" \ + "sum -r $0 $0 | grep -c $0 && echo yes || echo wrongly_omitted_filename" \ + "2\nyes\n" "" "" +testing "sum -s file does print file's name" \ + "sum -s $0 | grep -c $0 && echo yes || echo wrongly_omitted_filename" \ + "1\nyes\n" "" "" +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/tail/tail-n-works b/release/src/router/busybox/testsuite/tail/tail-n-works new file mode 100644 index 00000000..0e1319fa --- /dev/null +++ b/release/src/router/busybox/testsuite/tail/tail-n-works @@ -0,0 +1,4 @@ +$ECHO -ne "abc\ndef\n123\n" >input +$ECHO -ne "def\n123\n" >logfile.ok +busybox tail -n 2 input > logfile.bb +cmp logfile.ok logfile.bb diff --git a/release/src/router/busybox/testsuite/tail/tail-works b/release/src/router/busybox/testsuite/tail/tail-works new file mode 100644 index 00000000..f3434d1a --- /dev/null +++ b/release/src/router/busybox/testsuite/tail/tail-works @@ -0,0 +1,4 @@ +$ECHO -ne "abc\ndef\n123\n" >input +$ECHO -ne "def\n123\n" >logfile.ok +busybox tail -2 input > logfile.bb +cmp logfile.ok logfile.bb diff --git a/release/src/router/busybox/testsuite/tar/tar-archives-multiple-files b/release/src/router/busybox/testsuite/tar/tar-archives-multiple-files old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/tar/tar-complains-about-missing-file b/release/src/router/busybox/testsuite/tar/tar-complains-about-missing-file old mode 100755 new mode 100644 index dd1f2fa8..26e8cbb3 --- a/release/src/router/busybox/testsuite/tar/tar-complains-about-missing-file +++ b/release/src/router/busybox/testsuite/tar/tar-complains-about-missing-file @@ -1,4 +1,3 @@ -# XFAIL touch foo tar cf foo.tar foo ! busybox tar xf foo.tar bar diff --git a/release/src/router/busybox/testsuite/tar/tar-demands-at-least-one-ctx b/release/src/router/busybox/testsuite/tar/tar-demands-at-least-one-ctx old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/tar/tar-demands-at-most-one-ctx b/release/src/router/busybox/testsuite/tar/tar-demands-at-most-one-ctx old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/tar/tar-extracts-all-subdirs b/release/src/router/busybox/testsuite/tar/tar-extracts-all-subdirs new file mode 100644 index 00000000..886c37ce --- /dev/null +++ b/release/src/router/busybox/testsuite/tar/tar-extracts-all-subdirs @@ -0,0 +1,12 @@ +# FEATURE: CONFIG_FEATURE_TAR_CREATE +mkdir -p foo/{1,2,3} +mkdir -p foo/1/{10,11} +mkdir -p foo/1/10/{100,101,102} +tar cf foo.tar -C foo . +rm -rf foo/* +busybox tar xf foo.tar -C foo ./1/10 +find foo | sort >logfile.bb +rm -rf foo/* +tar xf foo.tar -C foo ./1/10 +find foo | sort >logfile.gnu +cmp logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/tar/tar-extracts-file b/release/src/router/busybox/testsuite/tar/tar-extracts-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/tar/tar-extracts-from-standard-input b/release/src/router/busybox/testsuite/tar/tar-extracts-from-standard-input old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/tar/tar-extracts-multiple-files b/release/src/router/busybox/testsuite/tar/tar-extracts-multiple-files old mode 100755 new mode 100644 index e26901e8..7897d81d --- a/release/src/router/busybox/testsuite/tar/tar-extracts-multiple-files +++ b/release/src/router/busybox/testsuite/tar/tar-extracts-multiple-files @@ -1,5 +1,6 @@ touch foo bar tar cf foo.tar foo bar rm foo bar -busybox tar xf foo.tar -test -f foo -a -f bar +busybox tar -xf foo.tar +test -f foo +test -f bar diff --git a/release/src/router/busybox/testsuite/tar/tar-extracts-to-standard-output b/release/src/router/busybox/testsuite/tar/tar-extracts-to-standard-output old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/tar/tar-handles-cz-options b/release/src/router/busybox/testsuite/tar/tar-handles-cz-options old mode 100755 new mode 100644 index b2806bbe..5b55e46d --- a/release/src/router/busybox/testsuite/tar/tar-handles-cz-options +++ b/release/src/router/busybox/testsuite/tar/tar-handles-cz-options @@ -1,4 +1,5 @@ -# XFAIL +# FEATURE: CONFIG_FEATURE_TAR_CREATE +# FEATURE: CONFIG_FEATURE_TAR_GZIP touch foo busybox tar czf foo.tar.gz foo gzip -d foo.tar.gz diff --git a/release/src/router/busybox/testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list b/release/src/router/busybox/testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list old mode 100755 new mode 100644 index b76f0230..50336423 --- a/release/src/router/busybox/testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list +++ b/release/src/router/busybox/testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list @@ -1,4 +1,5 @@ -# FEATURE: CONFIG_FEATURE_TAR_EXCLUDE +# FEATURE: CONFIG_FEATURE_TAR_FROM +# FEATURE: CONFIG_FEATURE_TAR_CREATE touch foo tar cf foo.tar foo echo foo >foo.exclude diff --git a/release/src/router/busybox/testsuite/tar/tar-handles-exclude-and-extract-lists b/release/src/router/busybox/testsuite/tar/tar-handles-exclude-and-extract-lists old mode 100755 new mode 100644 index e715a477..2de0f0e9 --- a/release/src/router/busybox/testsuite/tar/tar-handles-exclude-and-extract-lists +++ b/release/src/router/busybox/testsuite/tar/tar-handles-exclude-and-extract-lists @@ -1,4 +1,5 @@ -# FEATURE: CONFIG_FEATURE_TAR_EXCLUDE +# FEATURE: CONFIG_FEATURE_TAR_FROM +# FEATURE: CONFIG_FEATURE_TAR_CREATE touch foo bar baz tar cf foo.tar foo bar baz echo foo >foo.exclude diff --git a/release/src/router/busybox/testsuite/tar/tar-handles-multiple-X-options b/release/src/router/busybox/testsuite/tar/tar-handles-multiple-X-options old mode 100755 new mode 100644 index 8321af85..155b27e6 --- a/release/src/router/busybox/testsuite/tar/tar-handles-multiple-X-options +++ b/release/src/router/busybox/testsuite/tar/tar-handles-multiple-X-options @@ -1,3 +1,5 @@ +# FEATURE: CONFIG_FEATURE_TAR_FROM +# FEATURE: CONFIG_FEATURE_TAR_CREATE touch foo touch bar tar cf foo.tar foo bar diff --git a/release/src/router/busybox/testsuite/tar/tar-handles-nested-exclude b/release/src/router/busybox/testsuite/tar/tar-handles-nested-exclude old mode 100755 new mode 100644 index ad39506c..39013a10 --- a/release/src/router/busybox/testsuite/tar/tar-handles-nested-exclude +++ b/release/src/router/busybox/testsuite/tar/tar-handles-nested-exclude @@ -1,4 +1,5 @@ -# FEATURE: CONFIG_FEATURE_TAR_EXCLUDE +# FEATURE: CONFIG_FEATURE_TAR_FROM +# FEATURE: CONFIG_FEATURE_TAR_CREATE mkdir foo touch foo/bar tar cf foo.tar foo diff --git a/release/src/router/busybox/testsuite/tar/tar_with_link_with_size b/release/src/router/busybox/testsuite/tar/tar_with_link_with_size new file mode 100644 index 00000000..5b61cc70 --- /dev/null +++ b/release/src/router/busybox/testsuite/tar/tar_with_link_with_size @@ -0,0 +1,29 @@ +# This tarball contains a softlink with size field != 0. +# If not ignored, it makes hext header to be skipped +# and data to be read as a header. +# GNU tar 1.15.1 has a bug here: tf won't work, but xf will. +tar1_bz2() +{ + $ECHO -ne "\x42\x5a\x68\x39\x31\x41\x59\x26\x53\x59\x14\x44\xe3\xdd\x00\x00" + $ECHO -ne "\x9a\xfb\x90\xca\x18\x00\xc0\x40\x03\xff\x80\x08\x00\x7b\xe3\xff" + $ECHO -ne "\x80\x04\x00\x00\x08\x30\x00\xd6\xb3\x09\x45\x19\x0d\x0d\x41\x84" + $ECHO -ne "\x1a\x68\xd0\x7a\x99\x90\x4a\x0a\x6d\x4c\xa3\x20\x7a\x41\xa0\x00" + $ECHO -ne "\x00\x55\x25\x34\x1a\x34\xd0\x00\x64\x64\x1a\x32\x3f\x76\x3c\x1c" + $ECHO -ne "\xd3\x3c\xa0\x84\x9b\x88\x05\x70\x90\xbb\x18\x28\x39\x29\xb3\x30" + $ECHO -ne "\xa8\x0a\x21\x70\x0c\x01\x32\x3b\xbe\xde\xd7\x13\x2e\xbd\x2a\x9c" + $ECHO -ne "\xa8\x42\x2a\x91\x15\xe2\xa1\xcd\x24\x37\x9c\x91\xaa\xc7\x14\xdb" + $ECHO -ne "\x4c\x08\xaa\xaf\x12\xeb\x6c\x37\x96\xb0\xa4\x25\x0c\xb4\x4b\xc5" + $ECHO -ne "\x52\x70\x3b\x25\x4c\x0e\x46\x67\x51\x54\x89\x13\x13\xf0\xa8\xe9" + $ECHO -ne "\x68\x4e\x8c\x81\xfc\x79\xe0\xb0\xd8\x79\x34\x94\x71\xa2\x0c\xbe" + $ECHO -ne "\x93\x61\x82\x95\x10\x88\xd1\xa6\x69\xaa\x38\x9c\xb6\xc2\xb2\x94" + $ECHO -ne "\x90\xc3\x82\x29\xe8\x8c\xb8\x95\x83\x32\x40\x61\x11\x11\xd3\xaa" + $ECHO -ne "\x3f\x8b\xb9\x22\x9c\x28\x48\x0a\x22\x71\xee\x80" +} +res1="\ +lrwxrwxrwx user/group 0 2008-07-19 15:02:37 firmware-372/sources/native/bin/chroot-setup.sh -> qemu-setup.sh +-rwxr-xr-x user/group 512 2008-07-19 15:02:37 firmware-372/sources/native/bin/qemu-setup.sh" + +export TZ=UTC-2 + +t=`tar1_bz2 | bunzip2 | busybox tar tvf -` +test x"$res1" = x"$t" diff --git a/release/src/router/busybox/testsuite/tar/tar_with_prefix_fields b/release/src/router/busybox/testsuite/tar/tar_with_prefix_fields new file mode 100644 index 00000000..1c7124d5 --- /dev/null +++ b/release/src/router/busybox/testsuite/tar/tar_with_prefix_fields @@ -0,0 +1,261 @@ +tar1_bz2() +{ + $ECHO -ne "\x42\x5a\x68\x39\x31\x41\x59\x26\x53\x59\x12\xd1\x86\x30\x00\x0c" + $ECHO -ne "\xb8\x7f\x80\xff\x50\x08\xa0\x5e\xff\xff\xfd\x7f\xff\xff\xee\xff" + $ECHO -ne "\xff\xff\xfa\x00\x08\x60\x0f\xc5\x3e\xf4\xdc\x00\x00\x59\x25\xbd" + $ECHO -ne "\xb8\x7a\x02\xb5\x82\x78\x25\xb0\x89\x54\x10\x11\x44\x8b\x36\x36" + $ECHO -ne "\xc8\x97\x0d\x34\x9a\x21\xa9\x36\xa9\xed\x32\x02\x8d\xa6\x81\x8a" + $ECHO -ne "\x79\x13\x4d\x1a\x03\x10\x69\xa0\xd3\x40\x64\x0f\x44\x68\x3d\x41" + $ECHO -ne "\x2a\x7a\x20\x09\xa1\x34\x9a\x09\xa4\xc8\xf5\x4f\x46\xa6\x86\x32" + $ECHO -ne "\x4c\x08\x00\x00\xd0\x06\x9a\x00\xd3\xd4\x11\x49\xa7\xb5\x20\x1a" + $ECHO -ne "\x7a\x80\x00\x00\x00\x00\xd0\x68\x00\x00\x00\x00\x00\x49\xa8\x89" + $ECHO -ne "\xa9\x31\x4f\x22\xa7\xea\x9b\x61\x53\xf4\x93\xf2\xa3\x47\xa4\xd3" + $ECHO -ne "\x41\xea\x06\x41\xa0\x0d\x00\x00\x00\x1e\xa0\x70\x34\xd3\x4d\x06" + $ECHO -ne "\x86\x86\x86\x46\x80\x64\x01\xa1\xa0\x34\xd1\x90\x00\x03\x09\x88" + $ECHO -ne "\x0d\x04\x89\x08\x00\x82\x7a\x4c\x42\x64\xc9\x3d\x1a\x29\xe9\xa2" + $ECHO -ne "\x3d\x46\x9e\x46\x9a\x13\x26\x9e\x53\x10\x01\x91\xea\x68\x19\xf0" + $ECHO -ne "\x73\xf2\xe0\xd1\x3c\x80\x01\xb1\x48\x44\x08\x9a\xba\xf3\x9e\x87" + $ECHO -ne "\xec\xc4\x4b\x02\x92\x80\x75\x00\x56\x42\x88\x10\x68\xcc\x06\x22" + $ECHO -ne "\x7c\x2b\xa7\xc8\x21\x91\x13\xe5\x72\xc0\xe6\x0c\x03\x10\xf2\x89" + $ECHO -ne "\x9c\x67\x6b\xc3\xe6\xae\x98\x85\x0a\x7f\x25\x2e\x3d\x84\x5b\xeb" + $ECHO -ne "\xf3\xff\xb3\x52\xf7\x6e\xf6\x92\xd6\x33\x5f\x4f\xd1\x3d\xb7\xc4" + $ECHO -ne "\x0d\x50\x02\x49\x01\xaf\xd0\x69\xbb\xd3\xe9\x63\x0a\x68\x36\x92" + $ECHO -ne "\xf2\x03\x1d\xf2\xe2\x35\xbc\x73\xd4\x44\xf6\xa0\xe0\x31\xd7\x7d" + $ECHO -ne "\x56\x96\xcb\x52\xfc\x79\xe0\xeb\xf7\x34\xd8\xda\x18\x72\x30\x94" + $ECHO -ne "\x53\x45\xf5\x54\x56\x6c\x0b\x50\xa0\xbc\xbd\xcc\xd8\x21\xab\x7b" + $ECHO -ne "\xa8\xa4\xe4\x78\x25\x73\xbf\x4b\x30\x38\x71\xe9\x3c\x14\x5d\xa3" + $ECHO -ne "\x12\x04\x6b\x37\x9d\xe5\xce\xa5\xd9\xd1\xa5\x69\x09\x08\xc4\x48" + $ECHO -ne "\x4b\x34\x58\x81\x15\x18\x88\xac\x11\x51\x88\x35\x0d\xd3\x13\x18" + $ECHO -ne "\x67\x73\x20\x5c\x28\x03\x26\xcd\x6d\x20\x90\xba\xa4\x12\xb3\x08" + $ECHO -ne "\x27\x74\x6a\x99\xdf\xb1\x20\x3d\x85\xe7\x5f\xab\x0e\x2e\xdc\x23" + $ECHO -ne "\x99\xe1\xef\x34\x68\xcd\xa9\xb0\xbf\xda\xec\x81\xdd\x66\xca\x21" + $ECHO -ne "\x13\x47\xd7\xca\x48\xcf\xeb\x25\xbb\x79\x6d\x40\xd0\xe4\x69\x3c" + $ECHO -ne "\x8f\x09\x1e\x7b\xaa\x4b\x91\x39\xac\xd6\xd2\x0c\x85\x1d\xf7\x70" + $ECHO -ne "\x1f\x1e\x58\xbb\x22\x11\x29\x39\x14\x4d\x58\x81\x9f\xd7\x1e\x22" + $ECHO -ne "\x21\x91\x0a\x40\xd1\x87\x29\x99\x93\xf4\xf3\x25\x48\xbb\xb4\x24" + $ECHO -ne "\x2a\x1c\xa7\x28\xc1\x68\x08\x25\x00\xaa\x3d\xee\xae\xc1\xe1\x4f" + $ECHO -ne "\xe6\x9a\x26\x6b\xcf\xb1\x3e\xb9\x85\x04\xf4\xef\xff\x7a\x2f\x2a" + $ECHO -ne "\x04\x08\xe0\x4c\xb8\xbd\x8b\x81\xbf\xa2\xbe\x82\x52\x9b\x40\x63" + $ECHO -ne "\xe6\xf3\xb3\xe4\xe6\xe5\x94\x4a\xdd\xc3\x1b\xaf\x61\xf3\xbf\x5b" + $ECHO -ne "\x6d\xaa\xaa\x27\xe8\x50\x8d\x23\x97\xa4\xbd\xc3\xd2\xe6\xb5\x66" + $ECHO -ne "\x9a\x1a\x8e\x45\x2a\xed\x0b\x79\xb8\x89\x38\x4a\x04\x85\x0d\x1e" + $ECHO -ne "\x2b\x77\x51\x91\x5f\x9f\xe0\x2a\x49\x56\xd3\xa1\xde\xf6\xd7\x88" + $ECHO -ne "\x5a\x61\xe5\x04\x54\xdf\xa3\x92\xeb\xbf\x75\x39\xce\xfa\xf5\xde" + $ECHO -ne "\x30\xd7\x56\xd1\x7d\x2c\xdf\xda\x3e\x1c\xc8\xc2\x93\x61\x21\x20" + $ECHO -ne "\xb2\x22\x6d\xbe\x39\x52\x64\xf6\xb3\x91\x21\x86\xdb\x67\x72\x8f" + $ECHO -ne "\x49\xad\xe4\x93\x39\x5c\x34\x8f\x58\xdb\x58\xd3\x3c\x1e\x4c\x6c" + $ECHO -ne "\xbb\x70\x6f\x42\xcf\x9e\xbf\xb1\xcb\xa9\x8d\x05\xe7\xea\xea\xd7" + $ECHO -ne "\x3c\x67\x31\x69\x44\x33\xa4\x92\x9c\x65\xa4\x89\x5a\xae\xcf\xc9" + $ECHO -ne "\x55\x43\x62\x6d\xbf\x05\x3c\xd1\x0f\x01\x4a\xb5\x1d\xbb\x2c\xfb" + $ECHO -ne "\xa6\xb7\xb3\xb1\x1d\x66\xd3\xeb\x22\xd0\xb5\x5a\x4b\xc4\x47\x47" + $ECHO -ne "\x5a\x49\x85\x18\xbc\x15\x39\x3b\x92\xee\x51\x98\x33\x34\x5d\xb5" + $ECHO -ne "\xbb\x8b\x94\x8c\xde\x8e\x3f\x3d\x09\x4f\xba\xd3\xf6\x79\x74\x8e" + $ECHO -ne "\x82\x0d\x56\x85\xa2\xc7\xc6\xa6\x89\x29\x26\xa3\x53\x5e\x52\xf5" + $ECHO -ne "\x56\x74\x8b\x17\x82\xed\x7a\x8b\x68\x61\xa5\xc9\x7c\xde\x9f\x68" + $ECHO -ne "\x27\x4d\xea\x65\x68\x6f\x7d\x5e\x88\x73\x87\x6c\x92\xf2\xa9\x15" + $ECHO -ne "\x4e\xee\x4d\x41\xbb\x98\x5d\x8a\xaf\xcb\x11\x7b\x2a\xce\xf4\x1e" + $ECHO -ne "\x3a\x28\x48\x14\xfe\x7f\x09\x45\x48\xf1\x5b\xc1\xcb\xcd\x91\xba" + $ECHO -ne "\x3b\xe2\x7d\x57\x85\x66\x68\xec\x51\x82\x97\x88\xeb\x94\x3b\x78" + $ECHO -ne "\x6c\xf4\xf1\x3e\x38\x8d\x22\x16\xab\x3b\x13\xb3\x1b\x39\x94\x0e" + $ECHO -ne "\xa8\x26\xb7\x8d\xe9\x7d\x66\x23\x4b\x65\x07\xb7\x2b\xc9\x96\xb6" + $ECHO -ne "\x99\x12\x22\xbc\x90\xda\x51\xbc\xfd\x97\xa5\x7d\xbc\x12\xa6\x72" + $ECHO -ne "\xd3\xe3\x8c\xc7\x58\xe1\xf8\x28\xf4\x46\x49\x14\xd0\x9d\xb6\xed" + $ECHO -ne "\xce\x99\xc6\xbc\xed\xa3\xab\xa0\x8c\x9d\xce\x1a\x1a\xc2\xe6\x77" + $ECHO -ne "\xba\xae\xba\xd6\xc9\xb2\xd1\x65\x24\x7b\x0d\xd4\xf2\xac\x28\xc3" + $ECHO -ne "\x1c\xbe\x4a\x54\xe3\x0f\x8d\xad\xb2\x37\x9e\x1f\x81\x72\x2d\xab" + $ECHO -ne "\x8f\xb1\xcd\xf7\xb4\x51\x2f\x1d\xf8\xad\x77\x14\x37\xd2\x1a\x9a" + $ECHO -ne "\xc0\xf2\x48\xc6\x4c\x8d\xd3\x8d\xf1\xd9\x2e\x2c\xdd\x7a\x98\x3c" + $ECHO -ne "\x24\x76\xb9\x9d\x27\xcd\x71\x7d\x6c\xc7\x1f\x0a\x74\x8a\x6e\x54" + $ECHO -ne "\xec\x5a\xa1\x77\x60\x80\xef\x00\xa4\x5f\x9e\x8b\x2f\x02\x72\x9c" + $ECHO -ne "\x46\xd8\x79\x92\x4c\x8f\x4e\x37\xed\x0c\x58\xab\x44\xee\x1d\xd1" + $ECHO -ne "\xa1\xb0\xa5\x1f\xaf\xb0\x39\x01\x26\xb2\x4a\x20\x68\x4a\x18\x23" + $ECHO -ne "\xc3\x03\x84\x22\x18\xdb\x6d\x83\x60\xc1\x12\x09\x21\x84\x22\x48" + $ECHO -ne "\x7f\x1e\x17\xf5\xbe\xce\x4c\x4f\x9f\x9f\xee\xf4\xfe\xef\x9a\x34" + $ECHO -ne "\x91\x8f\x36\x1d\xbc\x73\xd7\xeb\xc8\x2e\x81\x25\xfa\x18\x76\x35" + $ECHO -ne "\x1f\x16\xdb\x20\x4b\x74\x6d\x94\x4e\xe5\x36\xed\xf5\x5d\x59\xaf" + $ECHO -ne "\x46\x70\xea\x03\xac\x50\xbb\x26\xab\x39\x9a\x4b\x6b\x09\x8c\x6d" + $ECHO -ne "\x34\xcf\xed\xaa\xf7\x56\x40\xf2\xab\x07\xca\x22\x71\x97\xc7\x35" + $ECHO -ne "\xe8\x06\x90\x7b\xec\xc3\x9f\xa4\xde\xd9\xdb\x43\xf1\xd5\x06\x58" + $ECHO -ne "\x72\x9e\x1f\x08\xb6\xc2\x05\x0d\x25\xfe\x7a\x85\xe5\x10\x12\x68" + $ECHO -ne "\x18\x7e\x8c\xa0\xfa\xb4\xc4\xc7\x4e\xa9\xf2\x13\xd7\xc2\x52\xb5" + $ECHO -ne "\xe3\x72\x37\x31\x1e\x4f\x99\xfd\xac\x97\x08\x88\x71\x88\xeb\x1a" + $ECHO -ne "\xf9\xa1\x10\x9c\x44\x08\x56\x4a\x77\xaa\x0f\x19\x5f\x5f\xb3\x95" + $ECHO -ne "\xee\x9b\x9f\x5b\xb5\xc9\x0a\xf4\x28\x16\x25\x34\x6c\x72\xda\x92" + $ECHO -ne "\xb4\x2c\xbd\x5e\xb1\xe8\xe5\x0f\x68\xf3\x44\x8a\xd5\xfa\x73\x5c" + $ECHO -ne "\x89\x2e\x99\x7d\xed\xe3\x5b\x3f\x48\x97\xeb\xb6\x76\x5c\xa5\x9d" + $ECHO -ne "\xef\x12\x1e\x42\x89\x52\xad\x28\x90\xe5\x2b\x88\xa0\x4f\x11\x92" + $ECHO -ne "\xcd\xcc\x63\x40\x1a\xc7\x10\x0c\x2f\xcd\x01\xf2\x07\x38\xac\x14" + $ECHO -ne "\xe5\x90\xc0\x30\x21\xe2\xe3\x72\x0e\x3e\x04\xc8\x9e\xa7\x00\xdb" + $ECHO -ne "\x91\xdd\x9d\x80\xa4\x69\x2a\x48\x37\x97\xa4\x26\x5d\xae\x84\x1e" + $ECHO -ne "\x88\xf4\x83\x04\x24\xc9\x1f\x94\x61\x25\xf9\x82\xdd\xed\x2d\x96" + $ECHO -ne "\xad\x06\x45\xdd\x88\xd7\x50\x40\x14\xdc\x7c\xdb\x0f\x53\x96\x27" + $ECHO -ne "\xcb\x67\xac\xa6\xc1\x15\x2f\xc3\xdb\x2c\xca\x94\xb3\xf3\xd1\x6a" + $ECHO -ne "\xba\x34\x83\xd1\xcc\x40\x3e\x76\xa1\x69\x7f\x49\x33\xdc\xa7\x3c" + $ECHO -ne "\x6a\x67\x15\xab\xdb\x52\xa0\xb8\xa6\x1e\xce\xe3\xaf\xf4\xa2\x62" + $ECHO -ne "\x35\x0f\x03\x40\x8e\x20\x12\x9c\xb6\x34\x71\x3a\x15\x5d\xe5\x34" + $ECHO -ne "\xa8\xd4\x05\x99\x6b\x9a\xb6\x41\x0b\x78\xc4\xd8\xd9\x7a\x65\xdc" + $ECHO -ne "\xdb\xe3\x42\xd5\x66\xf9\xb4\x83\x7e\xc0\xf4\x01\xc4\xcc\x3b\x0e" + $ECHO -ne "\x15\xdc\x15\xc2\x3e\x04\x2f\xfc\x6b\x72\xeb\xf6\xaa\x16\x20\xde" + $ECHO -ne "\xd3\x3a\xb1\x10\xc6\x3c\xe8\x2b\xb8\xea\xda\x19\x6e\x36\xaa\xa4" + $ECHO -ne "\x23\x6d\xa0\x40\xd1\x5a\x0b\x7e\xa4\xd5\x2d\xcb\xa9\x15\x35\xba" + $ECHO -ne "\x93\x92\x45\x41\xb0\x1a\xd1\x13\x31\xb6\x44\x98\x78\x28\x15\xe4" + $ECHO -ne "\xae\xba\x58\xd1\x75\x36\x34\x1a\xd8\x28\xf1\x4a\x4c\xbc\x1b\xa8" + $ECHO -ne "\xf7\x57\x92\xbc\xe2\xb5\xda\xb6\xa6\x1d\x83\x37\x96\x43\x20\x84" + $ECHO -ne "\xcb\xb6\xd9\x3f\xeb\xfa\xa0\xfe\x9a\x7d\xee\x47\x98\xc4\xe7\xc4" + $ECHO -ne "\xbd\xc6\xf0\x6d\xb2\x26\x10\x1e\x78\xef\xf3\x28\x3e\x35\xe6\xe4" + $ECHO -ne "\xe6\xf3\x0f\x26\x34\x13\x85\xd0\xcf\x55\x0f\x8b\xd7\xe9\xf4\xdf" + $ECHO -ne "\x70\x68\xc0\xb5\x30\x3c\xb1\x01\xe8\x28\xae\x80\x26\x01\x8b\x15" + $ECHO -ne "\x0f\x80\x48\x18\x4b\xe2\xed\x59\x92\x31\xcf\xd2\x8f\x42\xbf\xee" + $ECHO -ne "\xbd\x07\x91\x24\xc6\x66\x5e\x8c\x9a\x48\x63\xe7\xac\x8a\x1e\xc5" + $ECHO -ne "\x69\x16\x8d\xac\x67\xdc\x75\x75\x82\xca\x19\x28\x36\x4d\x10\xf9" + $ECHO -ne "\x41\xcb\x15\x05\x64\xc7\xb0\xc3\x64\xf3\x48\x71\x60\xf2\xbd\xcc" + $ECHO -ne "\x37\xb1\x36\xbc\xa7\x2e\x6b\x20\x11\x51\x42\xe1\x8a\x29\xac\x44" + $ECHO -ne "\x8f\x63\x56\x23\xd4\xd4\x07\xb4\x60\xa4\xb8\xcd\xee\x49\xa5\x42" + $ECHO -ne "\xcc\x52\x00\x6f\xdc\x44\x20\x57\x7d\x36\xd7\x48\x1a\x22\x2c\xd0" + $ECHO -ne "\x19\x43\x51\x5e\x1c\x8c\x5f\x70\xc2\x6b\xcf\xea\xd4\x97\x61\x72" + $ECHO -ne "\x33\xc3\x9a\xd4\x06\xf1\x8a\x9a\xfe\x21\x83\x0b\xea\xf1\xfa\x2c" + $ECHO -ne "\x52\x23\x2c\xb8\xc1\xe6\xc8\x9d\x9c\x5f\x8f\xf2\x4a\x86\x76\x92" + $ECHO -ne "\x78\x0f\x7d\x9d\x09\x38\xce\xe1\x9a\xf3\x60\xed\x65\x0b\x1a\x68" + $ECHO -ne "\xa6\x52\x39\x18\x1e\x45\xe3\x5d\xe0\x7d\xfb\xc6\xcc\x44\x18\x93" + $ECHO -ne "\xe9\x71\xa8\x18\x0d\x74\x48\x8a\x18\x0b\x61\xbf\xe1\xa9\x0e\x4c" + $ECHO -ne "\xad\x1b\xaf\x1a\x37\x39\x92\x4d\xcc\x96\x87\x46\x0d\x83\x06\x33" + $ECHO -ne "\x53\x35\xd9\x2c\x36\x98\x28\x1c\x52\xb1\x89\x55\x56\xcc\x37\x20" + $ECHO -ne "\x89\x84\x0e\x3d\x27\x2f\xc6\xfa\x78\x04\xe1\xd5\xc6\x90\x49\x16" + $ECHO -ne "\xfe\x0a\x16\x6f\x11\x54\x42\x22\xa1\x90\x2d\x19\x91\x28\x05\xf2" + $ECHO -ne "\x30\x6c\x14\x16\xd6\x8a\xce\xf6\xcd\x7c\x64\x76\x42\xe9\x28\xe9" + $ECHO -ne "\x1c\xd1\xb8\x9e\xcd\x53\xb2\x6b\x8d\x57\x57\x2a\xb8\x59\x58\x8c" + $ECHO -ne "\xd3\x12\x57\xa6\xe3\x48\x70\xf5\x55\x0f\x76\xb5\x27\x08\xd1\xa0" + $ECHO -ne "\xf8\x60\x09\xa1\xf2\x30\x43\x4a\x30\x46\xf7\x96\x19\xe9\x3a\x44" + $ECHO -ne "\xc0\xd8\xa8\x51\xae\x50\x92\x81\x81\xda\x10\xd3\x18\x62\x94\xd0" + $ECHO -ne "\x9e\x54\x0b\x22\xcc\xd0\xfe\x0c\x36\x44\x4d\x4d\x40\x5c\xa8\x35" + $ECHO -ne "\xb6\x53\x9c\x36\x9c\x5a\x0e\x0e\xb0\x5c\x29\x2a\x35\x66\xaa\x3a" + $ECHO -ne "\xcb\x23\x7b\xbb\xc8\x60\xbc\xb4\x28\xf4\x6e\xfe\x86\xfc\x16\x85" + $ECHO -ne "\x0c\xe0\x1d\xcf\xfd\x12\x28\xc6\x60\xd0\xe6\x2f\x76\xf0\x1a\x5b" + $ECHO -ne "\xfa\xa6\xc6\xea\x58\xbb\x26\x37\x84\xdd\x85\xd5\x37\x82\x76\xd9" + $ECHO -ne "\x14\x7a\xca\xed\x13\x72\xc3\xe1\xb9\x69\x45\xd4\xec\x44\x94\x26" + $ECHO -ne "\x8e\x0b\x90\xb6\x8b\x1f\x1e\x01\x96\x5a\xb9\x51\xa6\x27\xa2\x9b" + $ECHO -ne "\x38\xd9\x25\x32\x9b\x54\xfc\x45\xd1\xa8\x59\x35\x1a\xb0\xb2\x1a" + $ECHO -ne "\xc8\x88\x15\x42\x98\x50\x99\x12\x9e\xf5\x59\xb2\x5c\xc5\xa7\x34" + $ECHO -ne "\x35\xca\xb3\xed\xdc\xc9\x9f\x3e\x77\x8f\x6c\xde\xc8\x41\x6a\xc5" + $ECHO -ne "\x24\x85\x04\xa1\x2f\xe3\x47\x8c\x47\xd4\xdb\x74\x8c\xb6\x4c\xef" + $ECHO -ne "\xed\xad\x9f\x86\x31\xd8\xc8\x07\xc5\x11\x1c\x39\x3a\xf8\x75\x73" + $ECHO -ne "\xae\x78\x7d\x1d\x36\x5b\xd1\x23\x5d\x84\x17\x5d\x4b\xac\xd3\x70" + $ECHO -ne "\x8a\x83\x48\x48\x83\x7b\x5c\x99\x9e\x56\xbb\xfc\x0c\x4b\x04\xcf" + $ECHO -ne "\x83\x5d\xf8\x31\x2c\xc4\x5c\xa1\x68\x6a\x56\xe1\x7f\xbe\xd6\x59" + $ECHO -ne "\x6c\x55\xb0\x63\x41\xeb\x88\x69\xb6\x9b\x50\xc4\x31\xea\xb0\xd7" + $ECHO -ne "\xe2\xfb\x7b\xeb\xbb\x52\xc4\x97\x23\xe9\x16\x29\x18\x50\x4d\x0e" + $ECHO -ne "\x68\x62\xfb\x3f\xd9\x07\xb9\x89\x4d\x58\x7c\x32\x6d\x12\x3e\x9b" + $ECHO -ne "\x3a\x14\xee\xac\x3c\x8d\x09\x62\x30\x8e\xe0\x86\x84\xb9\xf3\x0d" + $ECHO -ne "\xf8\xad\x42\xa6\xbb\x7d\xd1\xf2\xf3\xc0\xe2\x32\xc4\x40\xaa\x8a" + $ECHO -ne "\x2a\xe9\xa9\x45\x83\x23\xf6\x90\x05\x24\x59\x22\x84\x50\x82\xc0" + $ECHO -ne "\x58\x41\x42\x18\x91\x3d\xd8\x80\xb1\x26\x68\xb2\xa8\xc0\x21\x14" + $ECHO -ne "\x18\xdf\x3a\x86\x25\x85\x56\xab\x20\x38\xcd\xdc\x98\x6e\x07\xc4" + $ECHO -ne "\x6b\x16\x55\xe0\x41\xe0\x41\xda\x29\x62\x8d\xba\xce\xa2\xcb\xfc" + $ECHO -ne "\x70\x78\x99\xf9\x16\x0b\x5a\x0c\xc5\xad\x18\xeb\xf0\xb5\xc9\x25" + $ECHO -ne "\x82\x16\xe0\x5d\xc1\xc4\xc6\xf0\x84\x6a\x45\x7d\xdb\x28\x46\xab" + $ECHO -ne "\xef\x32\xc9\x49\x50\x51\x60\x77\x1c\xfd\x58\x9c\x01\x3b\x7a\xfa" + $ECHO -ne "\x49\x47\x3e\x87\x1c\x39\xa6\x6a\xa4\xb7\x39\x93\xac\xac\xb0\x39" + $ECHO -ne "\x2f\xbc\xab\x9b\x52\x96\x24\x46\xc1\x95\xe4\x31\x89\x37\x18\xc8" + $ECHO -ne "\x2c\x22\x32\x2a\x8f\xb6\x58\x77\x57\x77\x2f\x09\xd0\x7c\xed\x74" + $ECHO -ne "\xaa\x7c\x86\x25\x45\x0c\x43\x4d\x31\xb0\x63\x40\xcf\x86\xfe\x75" + $ECHO -ne "\x76\xe0\xee\x99\xb5\x71\xe2\x4e\xe5\xc1\xf9\x2e\x48\xe2\xa6\x1b" + $ECHO -ne "\x28\xa5\xa3\xbe\xff\x37\xd1\xdd\x66\xa2\xe8\xd3\x88\x4d\x13\xd5" + $ECHO -ne "\x68\x51\x27\x41\xc3\x6c\x1b\x48\x67\x6a\xdf\x25\x2a\x40\xa1\x87" + $ECHO -ne "\x1d\x54\xb7\xe3\x91\xc2\x6b\x5b\xb9\x8c\xd5\x10\x11\x10\x16\xab" + $ECHO -ne "\x6b\xbe\x65\x6b\x73\xa7\x35\xa1\x09\x60\x60\xed\x96\x39\xc9\x40" + $ECHO -ne "\x5d\xdc\xee\x60\x49\x0c\x68\x18\x34\xb2\x6f\x2a\x95\x14\x29\x95" + $ECHO -ne "\x5b\x59\xd2\x1f\x63\x2a\xbe\xfd\xae\x09\x5c\xee\x11\xb5\x29\x36" + $ECHO -ne "\xca\xdf\x28\x8c\x65\x42\x46\x74\x0c\x39\x68\x30\xac\x2c\x2f\xd0" + $ECHO -ne "\x9b\xb3\x92\x19\x90\xa1\x07\xcc\xf6\xde\x64\x5f\x6f\xd7\xb6\xcc" + $ECHO -ne "\xe0\x70\x0f\x0b\xd2\x0e\x77\xa1\x70\xe3\x56\x90\x4b\x28\x58\xd0" + $ECHO -ne "\xd1\xe1\x9d\x18\x98\xba\x6b\x36\x54\xa9\x54\x09\x63\x49\x18\x55" + $ECHO -ne "\x60\xba\x11\xb1\x0a\x14\x45\x1f\xae\x08\x50\x09\x33\x00\xa2\xb2" + $ECHO -ne "\x71\x81\x75\x89\xb7\xb9\x0c\x73\xc0\x4c\x32\x89\x72\xac\xa9\xa3" + $ECHO -ne "\x47\x5f\x7d\x4e\x1b\x4d\xb9\xea\x84\x45\x00\x37\x3c\xb3\x7b\xf8" + $ECHO -ne "\xe7\x0f\xaa\x33\x1a\x9b\xc2\x0c\x35\x8a\xd4\x04\x46\x42\xcb\xab" + $ECHO -ne "\xaa\xc7\xe5\xc9\x20\x6e\x21\xa6\x8c\xed\x61\x86\x42\x87\x03\x25" + $ECHO -ne "\xde\x2c\x4a\x85\xcb\xb4\x36\xc9\xd4\x72\x60\x62\xc2\x19\xd0\x30" + $ECHO -ne "\x16\x6d\x58\x61\x62\x16\xe8\xd2\x0e\xd0\xf3\xdb\x53\x37\x07\x37" + $ECHO -ne "\x40\xc3\xe5\x5b\x9d\x16\x45\x60\x8e\xfb\x12\xc4\x5f\x9f\xdd\xe1" + $ECHO -ne "\x45\x5d\x45\x36\x21\xa0\xc0\xb8\x11\x98\x0f\x64\x98\x67\x1c\x11" + $ECHO -ne "\xa9\xa1\x65\x10\xb9\x22\x12\x91\x10\x9b\x10\x6f\x95\x2e\x34\x91" + $ECHO -ne "\x64\x82\xa4\x05\x02\xfc\x4a\x9f\x9c\x4d\x6c\x8d\x67\x26\x90\x63" + $ECHO -ne "\x04\x12\x6f\x0e\x55\x3c\x8e\xf2\x8d\xb4\x6b\x3d\xac\xcf\x84\x2e" + $ECHO -ne "\x60\x0f\x40\x62\x88\x3a\xcf\xbd\xea\xad\x40\x4c\x29\xe1\xb5\xb6" + $ECHO -ne "\x3e\x15\x86\xd5\xbe\xad\x27\xde\x2b\x32\xef\xcf\x97\x88\x8b\x17" + $ECHO -ne "\x80\x43\x0e\x20\x79\x3b\x36\x73\xb8\xad\x12\x0e\x87\x59\x5f\xd3" + $ECHO -ne "\x3c\x8c\x84\xc8\x54\x2b\x94\xc9\x2e\x36\x8b\x32\x48\xf1\xe3\x08" + $ECHO -ne "\xf0\x36\xc0\xb8\xc2\xa2\xa9\xe2\x52\x02\xf1\x9b\xcb\xde\xcc\xb5" + $ECHO -ne "\x5a\x6c\x05\x06\x31\x44\x41\x88\xa3\x05\x04\x16\x0d\x4a\x85\x20" + $ECHO -ne "\x79\xda\x89\x82\x1d\x5f\x5a\x11\x88\x89\x06\x05\xf5\xf4\xed\x75" + $ECHO -ne "\x62\x39\x37\x69\x11\x32\x3e\x8d\xe4\x60\x62\x52\xc9\xad\x82\x9a" + $ECHO -ne "\x9a\x2f\x06\x41\x26\xb4\x48\x70\x39\x2b\x8a\xb1\x5a\x53\xc6\x48" + $ECHO -ne "\x57\x17\xf5\xd8\x5a\xc6\x19\x83\x06\x0b\x9b\x04\xb8\xf5\xaf\x23" + $ECHO -ne "\x45\x87\x48\x50\x6d\x16\xea\xb4\x20\xb8\x49\x92\x6b\x0c\x76\x14" + $ECHO -ne "\x48\x53\xa1\x29\x74\xf6\xd7\x49\x44\x39\xba\xbd\x63\xa6\xf2\x81" + $ECHO -ne "\x8f\x5b\x5e\x46\x0a\x34\x95\x31\xc0\xdd\x60\x50\xd6\x0a\xa6\x29" + $ECHO -ne "\x3d\x36\x3a\xc7\xb8\xcf\x25\x5e\xf7\x82\x55\x88\xc2\x8b\x30\xd2" + $ECHO -ne "\x97\x90\x49\x94\xde\xe5\xaa\xeb\x42\x8c\x94\x2a\xa0\x0d\x9b\xb5" + $ECHO -ne "\x59\xbe\xcb\x35\xa3\x37\x54\x76\x35\x98\xcb\x1f\x13\x3f\x4a\xd1" + $ECHO -ne "\x45\x87\x67\xed\x66\x02\x06\x49\x1c\x59\x51\x1f\x4d\x85\x03\x46" + $ECHO -ne "\x65\x86\x4e\x4c\x6a\xd2\x24\x31\x5b\x6a\x3b\x19\x49\xe1\x83\x14" + $ECHO -ne "\xc1\xf0\x56\x61\x93\x8b\x33\x13\x54\x6f\x78\x4c\xa0\x85\xf0\xb3" + $ECHO -ne "\x17\xaa\xf2\x67\x02\x0c\x31\xed\x5e\x98\x02\x28\xc4\xe5\x87\xa2" + $ECHO -ne "\x70\xd1\xd5\x9c\xf8\xec\x19\x88\xa9\x0d\x0e\x4a\xe3\x47\x83\x6e" + $ECHO -ne "\xf7\x70\x3e\xa4\xa9\xc0\x4c\xfa\x2b\x3b\xd7\x6f\x96\xc3\x6d\x6d" + $ECHO -ne "\x71\x2a\x8d\x62\xf1\xd3\xdd\xb0\x33\xd4\x67\x19\x0d\x30\x85\x3a" + $ECHO -ne "\x06\x04\x85\x00\x48\x5d\x53\x35\xa0\x31\x56\x84\x82\xa5\xac\x22" + $ECHO -ne "\x02\x44\xaf\x6d\xc0\x61\x59\x23\x96\x72\x5a\x81\x9e\x0c\xe5\x79" + $ECHO -ne "\xda\xd0\x42\x5c\x89\xa5\x00\xec\x56\x41\x64\x8a\x11\x60\x79\xb1" + $ECHO -ne "\xed\x55\x16\x54\xe6\x51\x03\x34\x14\x60\x31\xd2\xf0\x0b\xce\xf2" + $ECHO -ne "\x4e\x4c\x45\x8c\xeb\x2a\x82\x3a\xa8\x52\xce\x8f\x4e\xf1\x89\xea" + $ECHO -ne "\x44\x91\x66\xdd\x6b\x49\xa3\x83\x0b\x19\x0e\x66\x5f\x02\x22\x58" + $ECHO -ne "\xe7\xc0\xa8\xce\x55\x48\xa6\x04\xf3\x03\xac\x62\xb2\xc0\xaa\xa0" + $ECHO -ne "\x09\xae\x5b\x96\xd0\xdd\xa9\x1f\xfb\x2d\x3d\xf5\x02\xe1\x86\x02" + $ECHO -ne "\x3e\xda\xd0\x5d\xba\x16\x39\xcd\x75\xa2\x47\x26\x74\x25\xa8\x5e" + $ECHO -ne "\xf3\x36\x0c\x37\x19\x17\x06\x66\xd0\x0b\x42\x41\x0a\xa0\xde\x93" + $ECHO -ne "\xd7\xb4\x9f\xfb\xc7\x4f\x65\x54\xda\xb8\x8b\x23\xde\x9c\x57\xcf" + $ECHO -ne "\x2d\x2a\x12\xda\xcc\xf6\x73\x83\x02\x4c\x0e\x42\x88\xda\x27\xb9" + $ECHO -ne "\xcb\x04\xb6\x07\x26\x78\xa1\xa1\x09\xa3\x6a\x86\xbd\x9d\xd4\xf9" + $ECHO -ne "\xc0\x81\xa6\x49\xa9\x72\xeb\x56\xbd\xf9\xea\x89\x4f\xae\x72\x28" + $ECHO -ne "\xb6\x57\x35\xbe\x94\xad\xc0\xff\x1e\xf2\x35\x24\xa0\x45\xd5\x09" + $ECHO -ne "\xc0\xe0\x10\xd0\x17\x90\xe2\xff\x8b\xb9\x22\x9c\x28\x48\x09\x68" + $ECHO -ne "\xc3\x18\x00" +} + +tar2_bz2() +{ + $ECHO -ne "\x42\x5a\x68\x39\x31\x41\x59\x26\x53\x59\x16\x08\xfd\x60\x00\x00" + $ECHO -ne "\x01\xff\x80\x48\x80\x00\xa0\x40\x03\xff\xc0\x72\x00\x89\x40\xff" + $ECHO -ne "\xe7\xdf\xc0\x20\x00\x92\x11\x53\xf5\x13\xd3\x53\x7a\x41\xa8\xf2" + $ECHO -ne "\x9a\x60\x21\x9a\x40\xf4\x9b\xd2\x0d\x09\xa5\x3c\xa6\x4f\x44\xf5" + $ECHO -ne "\x34\x34\xd1\xb5\x01\xa0\x3d\x41\xa4\xe1\xeb\x4c\x5a\x01\x47\x3b" + $ECHO -ne "\xd1\x67\x1a\x4c\x3b\x21\x84\x23\x2c\x5c\xf7\xe0\xbd\x2a\xa4\xea" + $ECHO -ne "\xdc\xdb\x71\x80\x26\x98\x21\x0e\x76\x21\x30\xce\xe4\xad\x8c\xb5" + $ECHO -ne "\x68\x62\x35\xa1\xfd\x8e\x7b\x51\x70\x96\xb1\x2c\xa2\x99\x6c\xa1" + $ECHO -ne "\xc2\xcd\xea\xa7\x5e\x6b\x91\x4f\x73\x96\xe4\x48\x3c\xe7\x8c\x0f" + $ECHO -ne "\x03\x64\x5b\x7a\x43\xc1\x68\x86\x41\x83\x46\x0b\xba\xaa\x6a\x9b" + $ECHO -ne "\x59\x34\xf1\x1c\x08\x69\x1d\x41\xfb\x4a\x96\x1b\x14\x9e\x32\x89" + $ECHO -ne "\x69\x5f\x63\x9a\x22\xe4\x96\x34\xff\x12\x20\xd0\x25\x70\xdc\x5d" + $ECHO -ne "\xc9\x14\xe1\x42\x40\x58\x23\xf5\x80" +} + +# NB: tar emits "tar: short read" on stderr because these test tars are +# also lacking proper terminating zeroed blocks. But exitcode is 0. +# This is intended. + +export TZ=UTC-1 + +# Case 1: long name, with path in prefix field +res1='-rw-r--r-- fm3/users 9869 2007-03-12 10:44:54 VirtualBox-1.5.6_OSE/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/public/ipcITransactionService.idl' +t=`tar1_bz2 | bunzip2 | busybox tar tvf -` +test x"$res1" = x"$t" +t=`tar1_bz2 | bunzip2 | busybox tar tv` +test x"$res1" = x"$t" + +# Case 2: long dir name, with ENTIRE path in prefix field (name = "") +res2='drwxr-xr-x fm3/users 0 2008-02-19 16:33:20 VirtualBox-1.5.6_OSE/src/VBox/Additions/linux/x11include/4.3/programs/Xserver/hw/xfree86/xf24_32bpp/' +t=`tar2_bz2 | bunzip2 | busybox tar tvf -` +test x"$res2" = x"$t" +t=`tar2_bz2 | bunzip2 | busybox tar tv` +test x"$res2" = x"$t" diff --git a/release/src/router/busybox/testsuite/taskset.tests b/release/src/router/busybox/testsuite/taskset.tests new file mode 100755 index 00000000..45993648 --- /dev/null +++ b/release/src/router/busybox/testsuite/taskset.tests @@ -0,0 +1,17 @@ +#!/bin/sh + +# Copyright 2006 Bernhard Reutner-Fischer +# Licensed under GPL v2 or later, see file LICENSE for details. + +. testing.sh +a="taskset" + +# testing "test name" "opts" "expected result" "file inp" "stdin" +testing "taskset (get from pid 1)" "$a -p 1 >/dev/null;echo \$?" "0\n" "" "" +testing "taskset (invalid pid)" "$a -p 0 >/dev/null 2>&1;echo \$?" "1\n" "" "" +testing "taskset (set_aff, needs CAP_SYS_NICE)" \ + "$a 0x1 $SHELL -c $a\ -p\ \$$\|grep\ \"current\ affinity\ mask:\ 1\" >/dev/null;echo \$?" \ + "0\n" "" "" + +unset a +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/tee/tee-appends-input b/release/src/router/busybox/testsuite/tee/tee-appends-input old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/tee/tee-tees-input b/release/src/router/busybox/testsuite/tee/tee-tees-input old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/test.tests b/release/src/router/busybox/testsuite/test.tests new file mode 100755 index 00000000..b7c84d9b --- /dev/null +++ b/release/src/router/busybox/testsuite/test.tests @@ -0,0 +1,79 @@ +#!/bin/sh + +# Copyright 2007 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# testing "test name" "command" "expected result" "file input" "stdin" +# file input will be file called "input" +# test can create a file "actual" instead of writing to stdout + +# Need to call 'busybox test', otherwise shell builtin is used + +testing "test: should be false (1)" \ + "busybox test; echo \$?" \ + "1\n" \ + "" "" + +testing "test '': should be false (1)" \ + "busybox test ''; echo \$?" \ + "1\n" \ + "" "" + +testing "test !: should be true (0)" \ + "busybox test !; echo \$?" \ + "0\n" \ + "" "" + +testing "test a: should be true (0)" \ + "busybox test a; echo \$?" \ + "0\n" \ + "" "" + +testing "test --help: should be true (0)" \ + "busybox test --help; echo \$?" \ + "0\n" \ + "" "" + +testing "test -f: should be true (0)" \ + "busybox test -f; echo \$?" \ + "0\n" \ + "" "" + +testing "test ! -f: should be false (1)" \ + "busybox test ! -f; echo \$?" \ + "1\n" \ + "" "" + +testing "test a = a: should be true (0)" \ + "busybox test a = a; echo \$?" \ + "0\n" \ + "" "" + +testing "test -lt = -gt: should be false (1)" \ + "busybox test -lt = -gt; echo \$?" \ + "1\n" \ + "" "" + +testing "test a -a !: should be true (0)" \ + "busybox test a -a !; echo \$?" \ + "0\n" \ + "" "" + +testing "test -f = a -o b: should be true (0)" \ + "busybox test -f = a -o b; echo \$?" \ + "0\n" \ + "" "" + +testing "test ! a = b -a ! c = c: should be false (1)" \ + "busybox test ! a = b -a ! c = c; echo \$?" \ + "1\n" \ + "" "" + +testing "test ! a = b -a ! c = d: should be true (0)" \ + "busybox test ! a = b -a ! c = d; echo \$?" \ + "0\n" \ + "" "" + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/testing.sh b/release/src/router/busybox/testsuite/testing.sh new file mode 100755 index 00000000..a57c4d68 --- /dev/null +++ b/release/src/router/busybox/testsuite/testing.sh @@ -0,0 +1,154 @@ +# Simple test harness infrastructurei for BusyBox +# +# Copyright 2005 by Rob Landley +# +# License is GPLv2, see LICENSE in the busybox tarball for full license text. + +# This file defines two functions, "testing" and "optional" +# and a couple more... + +# The following environment variables may be set to enable optional behavior +# in "testing": +# VERBOSE - Print the diff -u of each failed test case. +# DEBUG - Enable command tracing. +# SKIP - do not perform this test (this is set by "optional") +# +# The "testing" function takes five arguments: +# $1) Test description +# $2) Command(s) to run. May have pipes, redirects, etc +# $3) Expected result on stdout +# $4) Data to be written to file "input" +# $5) Data to be written to stdin +# +# The exit value of testing is the exit value of $2 it ran. +# +# The environment variable "FAILCOUNT" contains a cumulative total of the +# number of failed tests. + +# The "optional" function is used to skip certain tests, ala: +# optional CONFIG_FEATURE_THINGY +# +# The "optional" function checks the environment variable "OPTIONFLAGS", +# which is either empty (in which case it always clears SKIP) or +# else contains a colon-separated list of features (in which case the function +# clears SKIP if the flag was found, or sets it to 1 if the flag was not found). + +export FAILCOUNT=0 +export SKIP= + +# Helper functions + +optional() +{ + option=`echo ":$OPTIONFLAGS:" | grep ":$1:"` + # Not set? + if [ -z "$1" ] || [ -z "$OPTIONFLAGS" ] || [ ${#option} -ne 0 ] + then + SKIP= + return + fi + SKIP=1 +} + +# The testing function + +testing() +{ + NAME="$1" + [ -n "$1" ] || NAME="$2" + + if [ $# -ne 5 ] + then + echo "Test $NAME has wrong number of arguments (must be 5) ($# $*)" >&2 + exit 1 + fi + + [ -z "$DEBUG" ] || set -x + + if [ -n "$SKIP" ] + then + echo "SKIPPED: $NAME" + return 0 + fi + + $ECHO -ne "$3" > expected + $ECHO -ne "$4" > input + [ -z "$VERBOSE" ] || echo "echo '$5' | $2" + $ECHO -ne "$5" | eval "$2" > actual + RETVAL=$? + + if cmp expected actual >/dev/null 2>/dev/null + then + echo "PASS: $NAME" + else + FAILCOUNT=$(($FAILCOUNT + 1)) + echo "FAIL: $NAME" + [ -z "$VERBOSE" ] || diff -u expected actual + fi + rm -f input expected actual + + [ -z "$DEBUG" ] || set +x + + return $RETVAL +} + +# Recursively grab an executable and all the libraries needed to run it. +# Source paths beginning with / will be copied into destpath, otherwise +# the file is assumed to already be there and only its library dependencies +# are copied. + +mkchroot() +{ + [ $# -lt 2 ] && return + + $ECHO -n . + + dest=$1 + shift + for i in "$@" + do + #bashism: [ "${i:0:1}" == "/" ] || i=$(which $i) + i=$(which $i) # no-op for /bin/prog + [ -f "$dest/$i" ] && continue + if [ -e "$i" ] + then + d=`echo "$i" | grep -o '.*/'` && + mkdir -p "$dest/$d" && + cat "$i" > "$dest/$i" && + chmod +x "$dest/$i" + else + echo "Not found: $i" + fi + mkchroot "$dest" $(ldd "$i" | egrep -o '/.* ') + done +} + +# Set up a chroot environment and run commands within it. +# Needed commands listed on command line +# Script fed to stdin. + +dochroot() +{ + mkdir tmpdir4chroot + mount -t ramfs tmpdir4chroot tmpdir4chroot + mkdir -p tmpdir4chroot/{etc,sys,proc,tmp,dev} + cp -L testing.sh tmpdir4chroot + + # Copy utilities from command line arguments + + $ECHO -n "Setup chroot" + mkchroot tmpdir4chroot $* + echo + + mknod tmpdir4chroot/dev/tty c 5 0 + mknod tmpdir4chroot/dev/null c 1 3 + mknod tmpdir4chroot/dev/zero c 1 5 + + # Copy script from stdin + + cat > tmpdir4chroot/test.sh + chmod +x tmpdir4chroot/test.sh + chroot tmpdir4chroot /test.sh + umount -l tmpdir4chroot + rmdir tmpdir4chroot +} diff --git a/release/src/router/busybox/testsuite/touch/touch-creates-file b/release/src/router/busybox/testsuite/touch/touch-creates-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/touch/touch-does-not-create-file b/release/src/router/busybox/testsuite/touch/touch-does-not-create-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/touch/touch-touches-files-after-non-existent-file b/release/src/router/busybox/testsuite/touch/touch-touches-files-after-non-existent-file old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/tr.tests b/release/src/router/busybox/testsuite/tr.tests new file mode 100644 index 00000000..f91cc1f6 --- /dev/null +++ b/release/src/router/busybox/testsuite/tr.tests @@ -0,0 +1,31 @@ +#!/bin/sh + +# Copyright 2009 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# testing "description" "arguments" "result" "infile" "stdin" + +testing "tr does not treat [] in [a-z] as special" \ + "tr '[q-z]' '_Q-Z+'" \ + "_QWe+" "" "[qwe]" + +testing "tr understands 0-9A-F" \ + "tr -cd '[0-9A-F]'" \ + "19AF" "" "19AFH\n" + +testing "tr understands [:xdigit:]" \ + "tr -cd '[:xdigit:]'" \ + "19AF" "" "19AFH\n" + +testing "tr does not stop after [:digit:]" \ + "tr '[:digit:]y-z' 111111111123" \ + "111abcx23\n" "" "789abcxyz\n" + +testing "tr has correct xdigit sequence" \ + "tr '[:xdigit:]Gg' 1111111151242222333330xX" \ + "#1111111151242222x333330X\n" "" \ + "#0123456789ABCDEFGabcdefg\n" + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/tr/tr-d-alnum-works b/release/src/router/busybox/testsuite/tr/tr-d-alnum-works new file mode 100644 index 00000000..d440f8f3 --- /dev/null +++ b/release/src/router/busybox/testsuite/tr/tr-d-alnum-works @@ -0,0 +1,4 @@ +echo testing | tr -d '[[:alnum:]]' > logfile.gnu +echo testing | busybox tr -d '[[:alnum:]]' > logfile.bb + +diff -u logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/tr/tr-d-works b/release/src/router/busybox/testsuite/tr/tr-d-works new file mode 100644 index 00000000..a86bfbdf --- /dev/null +++ b/release/src/router/busybox/testsuite/tr/tr-d-works @@ -0,0 +1,4 @@ +echo testing | tr -d aeiou > logfile.gnu +echo testing | busybox tr -d aeiou > logfile.bb + +diff -u logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/tr/tr-non-gnu b/release/src/router/busybox/testsuite/tr/tr-non-gnu new file mode 100644 index 00000000..ffa6951a --- /dev/null +++ b/release/src/router/busybox/testsuite/tr/tr-non-gnu @@ -0,0 +1 @@ +echo fdhrnzvfu bffvsentr | busybox tr '[a-z]' '[n-z][a-m]' diff --git a/release/src/router/busybox/testsuite/tr/tr-rejects-wrong-class b/release/src/router/busybox/testsuite/tr/tr-rejects-wrong-class new file mode 100644 index 00000000..97539360 --- /dev/null +++ b/release/src/router/busybox/testsuite/tr/tr-rejects-wrong-class @@ -0,0 +1,19 @@ +echo t12esting | tr -d '[[:alpha:]]' > logfile.gnu +echo t12esting | tr -d '[:alpha:]' >> logfile.gnu +echo t12esting | tr -d '[[:alpha:]' >> logfile.gnu +echo t12esting | tr -d '[[:alpha:' >> logfile.gnu +echo t12esting | tr -d '[[:alpha' >> logfile.gnu +echo t12esting | tr -d '[:alpha:]' >> logfile.gnu +echo t12esting | tr -d '[:alpha:' >> logfile.gnu +echo t12esting | tr -d '[:alpha' >> logfile.gnu + +echo t12esting | busybox tr -d '[[:alpha:]]' > logfile.bb +echo t12esting | busybox tr -d '[:alpha:]' >> logfile.bb +echo t12esting | busybox tr -d '[[:alpha:]' >> logfile.bb +echo t12esting | busybox tr -d '[[:alpha:' >> logfile.bb +echo t12esting | busybox tr -d '[[:alpha' >> logfile.bb +echo t12esting | busybox tr -d '[:alpha:]' >> logfile.bb +echo t12esting | busybox tr -d '[:alpha:' >> logfile.bb +echo t12esting | busybox tr -d '[:alpha' >> logfile.bb + +diff -u logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/tr/tr-works b/release/src/router/busybox/testsuite/tr/tr-works new file mode 100644 index 00000000..2c0a9d19 --- /dev/null +++ b/release/src/router/busybox/testsuite/tr/tr-works @@ -0,0 +1,26 @@ +run_tr () +{ + echo -n "echo '$1' | tr '$2' '$3': " + echo "$1" | $bb tr "$2" "$3" + echo +} +tr_test () +{ + run_tr "cbaab" abc zyx + run_tr "TESTING A B C" '[A-Z]' '[a-z]' + run_tr "abc[]" "a[b" AXB + run_tr abc '[:alpha:]' A-ZA-Z + run_tr abc56 '[:alnum:]' A-ZA-Zxxxxxxxxxx + run_tr 012 '[:digit:]' abcdefghi + run_tr abc56 '[:lower:]' '[:upper:]' + run_tr " " '[:space:]' 12345 + run_tr " " '[:blank:]' 12 + run_tr 'a b' '[= =]' X + run_tr "[:" '[:' ab + run_tr " .,:" '[:punct:]' 12 + run_tr " .,:" '[:cntrl:]' 12 +} + +bb= tr_test > logfile.gnu +bb=busybox tr_test > logfile.bb +diff -u logfile.gnu logfile.bb diff --git a/release/src/router/busybox/testsuite/true/true-is-silent b/release/src/router/busybox/testsuite/true/true-is-silent old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/true/true-returns-success b/release/src/router/busybox/testsuite/true/true-returns-success old mode 100755 new mode 100644 diff --git a/release/src/router/busybox/testsuite/umlwrapper.sh b/release/src/router/busybox/testsuite/umlwrapper.sh new file mode 100755 index 00000000..e55e4dbd --- /dev/null +++ b/release/src/router/busybox/testsuite/umlwrapper.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Wrapper for User Mode Linux emulation environment + +RUNFILE="$(pwd)/${1}.testroot" +if [ -z "$RUNFILE" ] || [ ! -x "$RUNFILE" ] +then + echo "Can't run '$RUNFILE'" + exit 1 +fi + +shift + +if [ -z $(which linux) ] +then + echo "No User Mode Linux." + exit 1; +fi + +linux rootfstype=hostfs rw init="$RUNFILE" TESTDIR=`pwd` PATH="$PATH" $* quiet diff --git a/release/src/router/busybox/testsuite/unexpand.tests b/release/src/router/busybox/testsuite/unexpand.tests new file mode 100755 index 00000000..e7f42c5f --- /dev/null +++ b/release/src/router/busybox/testsuite/unexpand.tests @@ -0,0 +1,30 @@ +#!/bin/sh +# Copyright 2008 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# testing "test name" "options" "expected result" "file input" "stdin" + +testing "unexpand case 1" "unexpand" \ + "\t12345678\n" "" " 12345678\n" \ + +testing "unexpand case 2" "unexpand" \ + "\t 12345678\n" "" " 12345678\n" \ + +testing "unexpand case 3" "unexpand" \ + "\t 12345678\n" "" " 12345678\n" \ + +testing "unexpand case 4" "unexpand" \ + "\t12345678\n" "" " \t12345678\n" \ + +testing "unexpand case 5" "unexpand" \ + "\t12345678\n" "" " \t12345678\n" \ + +testing "unexpand case 6" "unexpand" \ + "\t12345678\n" "" " \t12345678\n" \ + +testing "unexpand case 7" "unexpand" \ + "123\t 45678\n" "" "123 \t 45678\n" \ + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/unexpand/unexpand-works-like-GNU b/release/src/router/busybox/testsuite/unexpand/unexpand-works-like-GNU new file mode 100644 index 00000000..a5258363 --- /dev/null +++ b/release/src/router/busybox/testsuite/unexpand/unexpand-works-like-GNU @@ -0,0 +1,52 @@ +rm -f foo bar +echo " y" | unexpand ../../busybox > foo +echo " y" | busybox unexpand ../../busybox > bar +set +e +test ! -f foo -a -f bar +if [ $? = 0 ] ; then + set -e + diff -q foo bar +fi +rm -f foo bar +echo " y" | unexpand ../../busybox > foo +echo " y" | busybox unexpand ../../busybox > bar +set +e +test ! -f foo -a -f bar +if [ $? = 0 ] ; then + set -e + diff -q foo bar +fi +echo " y y" | unexpand ../../busybox > foo +echo " y y" | busybox unexpand ../../busybox > bar +set +e +test ! -f foo -a -f bar +if [ $? = 0 ] ; then + set -e + diff -q foo bar +fi +rm -f foo bar +echo " y y" | unexpand ../../busybox > foo +echo " y y" | busybox unexpand ../../busybox > bar +set +e +test ! -f foo -a -f bar +if [ $? = 0 ] ; then + set -e + diff -q foo bar +fi +echo " y y" | unexpand -a ../../busybox > foo +echo " y y" | busybox unexpand -a ../../busybox > bar +set +e +test ! -f foo -a -f bar +if [ $? = 0 ] ; then + set -e + diff -q foo bar +fi +rm -f foo bar +echo " y y" | unexpand -a ../../busybox > foo +echo " y y" | busybox unexpand -a ../../busybox > bar +set +e +test ! -f foo -a -f bar +if [ $? = 0 ] ; then + set -e + diff -q foo bar +fi diff --git a/release/src/router/busybox/testsuite/uniq.tests b/release/src/router/busybox/testsuite/uniq.tests new file mode 100755 index 00000000..8961d669 --- /dev/null +++ b/release/src/router/busybox/testsuite/uniq.tests @@ -0,0 +1,87 @@ +#!/bin/sh + +# SUSv3 compliant uniq tests. +# Copyright 2005 by Rob Landley +# Licensed under GPL v2, see file LICENSE for details. + +# AUDIT: Full SUSv3 coverage (except internationalization). + +. testing.sh + +# testing "test name" "options" "expected result" "file input" "stdin" +# file input will be file called "input" +# test can create a file "actual" instead of writing to stdout + +# Test exit status + +testing "uniq (exit with error)" "uniq nonexistent 2> /dev/null || echo yes" \ + "yes\n" "" "" +testing "uniq (exit success)" "uniq /dev/null && echo yes" "yes\n" "" "" + +# Test various data sources and destinations + +testing "uniq (default to stdin)" "uniq" "one\ntwo\nthree\n" "" \ + "one\ntwo\ntwo\nthree\nthree\nthree\n" +testing "uniq - (specify stdin)" "uniq -" "one\ntwo\nthree\n" "" \ + "one\ntwo\ntwo\nthree\nthree\nthree\n" +testing "uniq input (specify file)" "uniq input" "one\ntwo\nthree\n" \ + "one\ntwo\ntwo\nthree\nthree\nthree\n" "" + +testing "uniq input outfile (two files)" "uniq input actual > /dev/null" \ + "one\ntwo\nthree\n" "one\ntwo\ntwo\nthree\nthree\nthree\n" "" +testing "uniq (stdin) outfile" "uniq - actual" \ + "one\ntwo\nthree\n" "" "one\ntwo\ntwo\nthree\nthree\nthree\n" +# Note: SUSv3 doesn't seem to require support for "-" output, but we do anyway. +testing "uniq input - (specify stdout)" "uniq input -" \ + "one\ntwo\nthree\n" "one\ntwo\ntwo\nthree\nthree\nthree\n" "" + + +#-f skip fields +#-s skip chars +#-c occurrences +#-d dups only +#-u +#-w max chars + +# Test various command line options + +# Leading whitespace is a minor technical violation of the spec, +# but since gnu does it... +testing "uniq -c (occurrence count)" "uniq -c | sed 's/^[ \t]*//'" \ + "1 one\n2 two\n3 three\n" "" \ + "one\ntwo\ntwo\nthree\nthree\nthree\n" +testing "uniq -d (dups only) " "uniq -d" "two\nthree\n" "" \ + "one\ntwo\ntwo\nthree\nthree\nthree\n" + +testing "uniq -f -s (skip fields and chars)" "uniq -f2 -s 3" \ +"cc dd ee8 +aa bb cc9 +" "" \ +"cc dd ee8 +bb cc dd8 +aa bb cc9 +" +testing "uniq -w (compare max characters)" "uniq -w 2" \ +"cc1 +" "" \ +"cc1 +cc2 +cc3 +" + +testing "uniq -s -w (skip fields and compare max chars)" \ +"uniq -s 2 -w 2" \ +"aaccaa +" "" \ +"aaccaa +aaccbb +bbccaa +" + +# -d is "Suppress the writing fo lines that are not repeated in the input." +# -u is "Suppress the writing of lines that are repeated in the input." +# Therefore, together this means they should produce no output. +testing "uniq -u and -d produce no output" "uniq -d -u" "" "" \ + "one\ntwo\ntwo\nthree\nthree\nthree\n" + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/unzip.tests b/release/src/router/busybox/testsuite/unzip.tests new file mode 100755 index 00000000..975079db --- /dev/null +++ b/release/src/router/busybox/testsuite/unzip.tests @@ -0,0 +1,38 @@ +#!/bin/sh + +# Tests for unzip. +# Copyright 2006 Rob Landley +# Copyright 2006 Glenn McGrath +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# testing "test name" "options" "expected result" "file input" "stdin" +# file input will be file called "input" +# test can create a file "actual" instead of writing to stdout + +# Create a scratch directory + +mkdir temp +cd temp + +# Create test file to work with. + +mkdir foo +touch foo/bar +zip foo.zip foo foo/bar > /dev/null +rm -f foo/bar +rmdir foo + +# Test that unzipping just foo doesn't create bar. +testing "unzip (subdir only)" "unzip -q foo.zip foo/ && test -d foo && test ! -f foo/bar && echo yes" "yes\n" "" "" + +rmdir foo +rm foo.zip + +# Clean up scratch directory. + +cd .. +rm -rf temp + +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/uptime/uptime-works b/release/src/router/busybox/testsuite/uptime/uptime-works new file mode 100644 index 00000000..80e57877 --- /dev/null +++ b/release/src/router/busybox/testsuite/uptime/uptime-works @@ -0,0 +1,2 @@ +busybox uptime + diff --git a/release/src/router/busybox/testsuite/uuencode.tests b/release/src/router/busybox/testsuite/uuencode.tests new file mode 100755 index 00000000..cb658db3 --- /dev/null +++ b/release/src/router/busybox/testsuite/uuencode.tests @@ -0,0 +1,28 @@ +#!/bin/sh + +# unit test for uuencode to test functionality. +# Copyright 2006 by Erik Hovland +# Licensed under GPL v2, see file LICENSE for details. + +# AUDIT: Unit tests for uuencode + +. testing.sh + +# testing "test name" "options" "expected result" "file input" "stdin" +# file input will be file called "input" +# test can create a file "actual" instead of writing to stdout + +# Test setup of standard input +saved_umask=$(umask) +umask 0 +testing "uuencode sets standard input mode correctly" \ + "uuencode foo 2!F;W@@:G5M<&5D(&]V97(@=&AE(&QA>GD@8G)O=VX@\n%9&]G+@H\`\n\`\nend\n" \ + "" "The fast grey fox jumped over the lazy brown dog.\n" +testing "uuencode correct base64 encoding" "uuencode -m bb_uuenc_test.out" \ +"begin-base64 644 bb_uuenc_test.out\nVGhlIGZhc3QgZ3JleSBmb3gganVtcGVkIG92ZXIgdGhlIGxhenkgYnJvd24g\nZG9nLgo=\n====\n" \ + "" "The fast grey fox jumped over the lazy brown dog.\n" +exit $FAILCOUNT diff --git a/release/src/router/busybox/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly b/release/src/router/busybox/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly deleted file mode 100755 index 0ccf23b5..00000000 --- a/release/src/router/busybox/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly +++ /dev/null @@ -1,6 +0,0 @@ -saved_umask=$(umask) -umask 0 -busybox uuencode foo logfile.gnu +find "$d" -name \*works -type f | busybox xargs md5sum > logfile.bb +diff -u logfile.gnu logfile.bb -- cgit v1.2.3-54-g00ecf