Commit Graph
53 Commits
Author SHA1 Message Date
e6d109e7e8 test: implement -r/-w/-x on Windows (#11120)
* test: implement -r/-w/-x on Windows

* test: fix clippy map-then-unwrap_or lint for Windows executable check

Replace `.map(...).unwrap_or(false)` with `.is_some_and(...)` to satisfy
the `clippy::option_map_unwrap_or` lint on Windows targets.

---------

Co-authored-by: Nihal Ajayakumar <nihal.ajayakumar@gmail.com>
2026-02-26 09:37:39 +01:00
Tuomas Tynkkynen 5500e1cc35 test: Trim whitespace in integer comparisons
Matches upstream behaviour.

Fixes #10410.
2026-01-26 16:54:09 +02:00
Martin PaulsenandGitHub 88051cba99 test: fixing unary operators that are getting parsed as argument instead of string literal (#9951)
* Check for three-string comparison in test

* Add regression tests for unary operator in three-arg form
2026-01-01 10:58:18 +01:00
Daniel Hofstetter e502d894dc test: existing file is newer than non-existing
existing -nt non-existing => true
non-existing -nt existing => false
existing -ot non-existing => false
non-existing -ot existing => true
2025-11-13 16:42:59 +01:00
Sylvestre Ledru a0179ea239 uutests: adjust the tests to use them 2025-03-28 21:40:31 +01:00
Nicolas Boichat 6b8135119c test_test: Simplify test_file_N
I found the logic a little difficult to understand, and the
comment probably doesn't match what `-N` is supposed to do?

Intead, let's just manually set mtime and atime.

Hopefully this helps clear up Android flakiness in #7570. Or at
least understand better what is going on.
2025-03-25 15:01:23 +01:00
Daniel Hofstetter 75260a5889 test: adapt test to new version string 2025-03-15 16:03:17 +01:00
Daniel Hofstetter df4dfea852 tests: replace run() with succeeds() or fails() 2025-03-09 16:53:56 +01:00
Sylvestre Ledru 3e1adf40ee Use the new function 'fails_with_code' v2 2025-03-04 09:27:47 +01:00
Sylvestre Ledru 18cb7dcf9e Use the new function fails_with_code
Done with
```
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.no_stdout\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2)\n\1.no_stdout();/gs' *rs
$ sed -i -e "s|.fails()(.*).code_is(|.fails_with_code(|g" *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2);/gs' *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)(.*?)[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\3)\2;/gs' *rs
...
```
2025-03-01 17:26:20 +01:00
4acc59d075 test: add < and > operators for string comparison (#7315)
* test: add < and > operators for string comparison

Fixes #7254.

* Add more tests for string inequality

* Use match in place of if/elseif block

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* Change test name to specify lt/gt operator

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-02-21 14:41:15 +01:00
Daniel Hofstetter 1910da5869 test: remove sleep from tests 2025-02-20 10:48:01 +01:00
Sylvestre Ledru f00a8c231b tests: Decrease the various sleeps 2025-01-27 22:08:42 +01:00
6b70dc232e test: -o arg should trigger an error (#6642)
* test: -o arg should trigger an error

Should fix tests/test/test-diag.pl

* test: use var directly in string

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-08-13 11:05:35 +02:00
Laurent Cheylus de4d91beda tests: disable failed tests for test on OpenBSD
Signed-off-by: Laurent Cheylus <foxy@free.fr>
2024-07-06 22:29:19 +02:00
n4n5 ab67947321 fix clippy tests 2024-06-30 16:27:08 +02:00
Daniel Hofstetter 9bb725cefc clippy: fix warnings introduced by Rust 1.75 2023-12-28 18:17:06 +01:00
Nathan HoughtonandSylvestre Ledru 1915e3c438 tests/test: Ensure the test fixture files have the expected gid
On some platforms (mostly the BSDs) the test fixture files copied to the
/tmp directory will have a different gid than the current egid (due to
the sticky bit set on the /tmp directory). Fix this before running the
"test" command.
2023-12-25 13:10:22 +01:00
Nathan HoughtonandDaniel Hofstetter 0ea1a7cd88 tests/cp, tests/test: Don't attempt to set sticky file bit on FreeBSD
On FreeBSD (and OpenBSD), only the superuser can set the file sticky
bit.
2023-12-02 16:58:27 +01:00
Nathan Houghton dbfd700502 test: use mtime for -ot and fix direction of comparison
- Use the file modification time instead of the creation time (matches
  GNU coreutils documentation)

- Fix direction of comparison (a < b instead of a > b)

- Extend test case to cover both the 0 and 1 exit code cases
2023-10-22 17:44:40 -07:00
Terts Diepraam c3f9e19a3b all: normalize license notice in all *.rs files 2023-08-24 12:21:09 +02:00
bf5b765cba Remove the author copyright notices (#5184)
* Remove the author copyright notices

Rational:
* not maintained
* does not reflect reality
* don't provide any value (the info can be found in the git log)
* we don't have rules to update them
  (ex: should you update it after one line, two lines, etc)

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-08-21 12:23:18 +02:00
leon3s bf94e8fff1 test: refactor error handling with ParseError enum 2023-03-25 14:03:45 +01:00
Daniel Hofstetter 6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Joining7943 fdf0f96a01 tests/util: Restructure UCommand to run in shell per default. Introduce constant TESTS_BINARY.
Summary of changes in tests/util:

* Introduce global constant TESTS_BINARY holding the path to `coreutils`
* Implement running an arbitrary command in a sh or cmd shell per default.
* Implement std::fmt::Display for UCommand.
* Change usages of UCommand::util_name from &Option<OsStr> to Option<OsStr>
* `UCommand::new_from_tmp`: Use OsStr directly instead of TempDir -> String -> OsStr
* Collect arguments in `UCommand::args` field
* Build environment variables in `UCommand` itself instead of `std::process::Command`
* Move building of std::process:Command from fields in UCommand to own method `build`
* Remove assertions of UCommand::has_run in arg, args and env.

Summary of changes in tests/by-util:

* Remove usages of UCommand::raw. Fix tests to use UCommand::to_string.
* test_test: Adjust test_invalid_utf8_integer_compare to use `UCommand::args`
* test_chmod: run_single_test
* test_pwd: symlinked_env
* test_cp:
    Fix the usage of &Option<OsStr> in `test_src_base_dot`
    Refactor test_src_base_dot to not use UCommand::new but ts.ucmd() instead
2023-02-17 17:39:33 +01:00