Commit graph

13 commits

Author SHA1 Message Date
Jan Scheer
abc59fbe85
tests/common: refactor: use TestScenario instead of util_name for expected_result() 2021-07-07 22:46:16 +02:00
Jan Scheer
735ec4014e
test_who: refactor use expected_result from common/util.rs 2021-07-07 17:26:59 +02:00
Jan Scheer
90de4257b1
test_pinky: refactor use expected_result from common/util.rs 2021-07-07 15:53:46 +02:00
Jan Scheer
c0be979611 fix some issues with locale (replace "LANGUAGE" with "LC_ALL")
`LANGUAGE=C` is not enough, `LC_ALL=C` is needed as the environment
variable that overrides all the other localization settings.

e.g.
```bash
$ LANGUAGE=C id foobar
id: ‘foobar’: no such user

$ LC_ALL=C id foobar
id: 'foobar': no such user
```

* replace `LANGUAGE` with `LC_ALL` as environment variable in the tests
* fix the the date string of affected uutils
* replace `‘` and `’` with `'`
2021-06-23 11:30:28 +02:00
Roy Ivy III
9feff1e441 tests ~ fix cargo clippy complaint (*allow* clippy::needless_borrow; for *false positives*) 2021-06-06 19:28:25 -05:00
Roy Ivy III
3f35e0a421 refactor ~ cargo make format 2021-05-31 08:23:58 -05:00
Roy Ivy III
4e20dedf58 tests ~ refactor/polish spelling (comments, names, and exceptions) 2021-05-31 08:23:57 -05:00
Jan Scheer
007e0a4e7f who/stat/pinky: adjust tests to be compatible with running on macOS
A lot of tests depend on GNU's coreutils to be installed in order
to obtain reference values during testing.
In these cases testing is limited to `target_os = linux`.
This PR installs GNU's coreutils on "github actions" and adjusts the
tests for `who`, `stat` and `pinky` in order to be compatible with macOS.

* `brew install coreutils` (prefix is 'g', e.g. `gwho`, `gstat`, etc.
* switch paths for testing to something that's available on both OSs,
    e.g. `/boot` -> `/bin`, etc.
* switch paths for testing to the macOS equivalent,
    e.g. `/dev/pts/ptmx` -> `/dev/ptmx`, etc.
* exclude paths when no equivalent is available,
    e.g. `/proc`, `/etc/fstab`, etc.
* refactor tests to make better use of the testing API
* fix a warning in utmpx.rs to print to stderr instead of stdout
* fix long_usage text in `who`
* fix minor output formatting in `stat`

* the `expected_result` function should be refactored
    to reduce duplicate code
* more tests should be adjusted to not only run on `target_os = linux`
2021-05-21 11:55:20 +02:00
Jan Scheer
a4fc2b5106 who: fix --lookup
This closes #2181.

`who --lookup` is failing with a runtime panic (double free).
Since `crate::dns-lookup` already includes a safe wrapper for `getaddrinfo`
I used this crate instead of further debugging the existing code in
utmpx::canon_host().

* It was neccessary to remove the version constraint for libc in uucore.
2021-05-13 22:16:15 +02:00
Jan Scheer
798a033311 pinky: move from getopts to clap (#2123) 2021-04-30 20:57:38 +02:00
Gilad Naaman
b91fadd8f4 Refactored tests for more utilities 2021-04-18 02:32:43 +03:00
Gilad Naaman
7c7e64e79c pinky, mktemp: Remove direct usage of CmdResult fields in test 2021-04-17 15:14:49 +03:00
Roy Ivy III
de0375f909 tests ~ reorganize tests 2020-06-01 18:30:04 -05:00
Renamed from tests/test_pinky.rs (Browse further)