Project

General

Profile

Actions

Feature #14213

closed

Want basic ar test suite

Added by Robert Mustacchi 7 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Category:
tests
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

With the issues that #14105 initially caused, it's clear that having a basic test suite will help a bunch here. While not sufficient to cover all testing, having this will be a great boon and in fact is what discovered #14212.

Actions #1

Updated by Electric Monk 7 months ago

  • Gerrit CR set to 1723
Actions #2

Updated by Robert Mustacchi 6 months ago

I ended up writing a variety of tests here that cover a bunch of behavior. The ar test run actually describes them all fairly well:

rm@iliad:~$ /opt/util-tests/tests/ar/artest
TEST PASSED: basic archive creation
TEST PASSED: restoring stripped archive with -s
TEST PASSED: restoring stripped archive with -st
TEST PASSED: ar -sv has proper output
TEST PASSED: restoring stripped archive with -sv
ar: creating /tmp/ar.110216/rs.a
TEST PASSED: ar -rs creates archives
TEST PASSED: ar -crs creates archives
TEST PASSED: incremental archive creation
TEST PASSED: positional tests: ar -cra
TEST PASSED: positional tests: ar -crb
TEST PASSED: positional tests: ar -cri
TEST PASSED: ar -x
ar: ar_test0.o already exists. Will not be extracted
TEST PASSED: ar -Cx did not overwrite existing file
TEST PASSED: ar -Cx extracted file that didn't exist
TEST PASSED: ar -xs
TEST PASSED: ar -ma
TEST PASSED: ar -mb
TEST PASSED: ar -t (output 01)
TEST PASSED: ar -t (output 10)
TEST PASSED: invalid arguments 
TEST PASSED: invalid arguments -z
TEST PASSED: invalid arguments -d
TEST PASSED: invalid arguments -d /tmp/ar.110216/enoent
TEST PASSED: invalid arguments -d /tmp/ar.110216/test01.a foobar.exe
TEST PASSED: invalid arguments -m /tmp/ar.110216/enoent
TEST PASSED: invalid arguments -ma foobar.exe /tmp/ar.110216/enoent
TEST PASSED: invalid arguments -mb foobar.exe /tmp/ar.110216/enoent
TEST PASSED: invalid arguments -mi foobar.exe /tmp/ar.110216/enoent
TEST PASSED: invalid arguments -p /tmp/ar.110216/enoent
TEST PASSED: invalid arguments -P /tmp/ar.110216/enoent
TEST PASSED: invalid arguments -q
TEST PASSED: invalid arguments -qa foobar.exe .a
TEST PASSED: invalid arguments -qb foobar.exe .a
TEST PASSED: invalid arguments -qi foobar.exe .a
TEST PASSED: invalid arguments -qa ar_test0.o .a
TEST PASSED: invalid arguments -qb ar_test0.o .a
TEST PASSED: invalid arguments -qi ar_test0.o .a
TEST PASSED: invalid arguments -r
TEST PASSED: invalid arguments -ra foobar.exe
TEST PASSED: invalid arguments -ra foobar.exe /tmp/ar.110216/enoent
TEST PASSED: invalid arguments -rb foobar.exe
TEST PASSED: invalid arguments -rb foobar.exe /tmp/ar.110216/enoent
TEST PASSED: invalid arguments -ri foobar.exe
TEST PASSED: invalid arguments -ri foobar.exe /tmp/ar.110216/enoent
TEST PASSED: invalid arguments -t
TEST PASSED: invalid arguments -t /tmp/ar.110216/enoent
TEST PASSED: invalid arguments -x
TEST PASSED: invalid arguments -x /tmp/ar.110216/enoent
TEST PASSED: invalid arguments -s
TEST PASSED: invalid arguments -s /tmp/ar.110216/enoent
TEST PASSED: invalid arguments -s /tmp/ar.110216/test01.a /tmp/ar.110216/test10.a
TEST PASSED: invalid arguments -sz /tmp/ar.110216/test01.a
TEST PASSED: invalid arguments -rd
TEST PASSED: invalid arguments -xd
TEST PASSED: invalid arguments -qp
All tests passed successfully!

So we've covered most major operations in ar, though certainly not everything. At least it's better than we started. I also verified that this works in the broader util test suite:

rm@iliad:~$ pfexec /opt/util-tests/bin/utiltest 
Test: /opt/util-tests/tests/allowed-ips (run as root)             [00:01] [PASS]
Test: /opt/util-tests/tests/ar/artest (run as root)               [00:02] [PASS]
Test: /opt/util-tests/tests/chown_test (run as root)              [00:01] [PASS]
Test: /opt/util-tests/tests/date_test (run as root)               [00:00] [PASS]
Test: /opt/util-tests/tests/find/findtest (run as root)           [00:00] [PASS]
Test: /opt/util-tests/tests/grep_test (run as root)               [00:03] [PASS]
Test: /opt/util-tests/tests/head/head_test (run as root)          [00:00] [PASS]
Test: /opt/util-tests/tests/libjedec_test (run as root)           [00:00] [PASS]
Test: /opt/util-tests/tests/libsff/libsff (run as root)           [00:00] [PASS]
Test: /opt/util-tests/tests/make_test (run as root)               [00:01] [PASS]
Test: /opt/util-tests/tests/mdb/mdbtest (run as root)             [00:00] [PASS]
Test: /opt/util-tests/tests/mergeq/mqt (run as root)              [00:01] [PASS]
Test: /opt/util-tests/tests/mergeq/wqt (run as root)              [00:00] [PASS]
Test: /opt/util-tests/tests/pcidbtest (run as root)               [00:02] [PASS]
Test: /opt/util-tests/tests/pcieadm-priv (run as root)            [00:02] [PASS]
Test: /opt/util-tests/tests/pcieadmtest (run as root)             [00:05] [PASS]
Test: /opt/util-tests/tests/printf_test (run as root)             [00:00] [PASS]
Test: /opt/util-tests/tests/set-linkprop (run as root)            [00:00] [PASS]
Test: /opt/util-tests/tests/sleep/sleeptest (run as root)         [00:43] [PASS]
Test: /opt/util-tests/tests/smbios (run as root)                  [00:00] [PASS]
Test: /opt/util-tests/tests/svr4pkg_test (run as root)            [00:00] [PASS]
Test: /opt/util-tests/tests/xargs_test (run as root)              [00:00] [PASS]
Test: /opt/util-tests/tests/awk/runtests.sh (run as nobody)       [02:33] [PASS]
Test: /opt/util-tests/tests/ctf/precheck (run as root)            [00:00] [PASS]
Test: /opt/util-tests/tests/ctf/ctftest (run as root)             [00:10] [PASS]
Test: /opt/util-tests/tests/demangle/afl-fast (run as root)       [00:01] [PASS]
Test: /opt/util-tests/tests/demangle/gcc-libstdc++ (run as root)  [00:00] [PASS]
Test: /opt/util-tests/tests/demangle/llvm-stdcxxabi (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libcustr/custr_remove (run as root)   [00:00] [PASS]
Test: /opt/util-tests/tests/libcustr/custr_trunc (run as root)    [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_00_blank (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_01_boolean (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_02_numbers (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_03_empty_arrays (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_04_number_arrays (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_05_strings (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_06_nested (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_07_nested_arrays (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/sed/sed_addr (run as root)            [00:00] [PASS]
Test: /opt/util-tests/tests/sed/multi_test (run as root)          [00:01] [PASS]

Results Summary
PASS      40

Running Time:   00:03:56
Percent passed: 100.0%
Actions #3

Updated by Electric Monk 6 months ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit fb25420ba8dbfa4c292d42c87555eee97a474854

commit  fb25420ba8dbfa4c292d42c87555eee97a474854
Author: Robert Mustacchi <rm@fingolfin.org>
Date:   2021-11-11T19:19:33.000Z

    14105 ar -s could work on its own
    14213 Want basic ar test suite
    14212 ar cra and crb don't work
    14214 ar usage message needs updating for -q
    Reviewed by: Rich Lowe <richlowe@richlowe.net>
    Reviewed by: Patrick Mooney <pmooney@pfmooney.com>
    Reviewed by: Andy Fiddaman <andy@omnios.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF