2 # Copyright (c) 2024 Klara, Inc.
4 # SPDX-License-Identifier: BSD-2-Clause
9 atf_set descr
"No arguments"
12 atf_check
-s exit:1 -e match
:"^usage:" \
18 atf_set descr
"One argument"
21 echo "void a(void) { }" >a.c
23 echo "a.o a.o" >output
24 atf_check
-o file:output \
28 atf_test_case dashdash
30 atf_set descr
"One argument"
33 echo "void a(void) { }" >a.c
35 echo "a.o a.o" >output
36 atf_check
-o file:output \
40 atf_test_case nonexistent
42 atf_set descr
"Nonexistent file"
45 atf_check
-s not-exit
:0 -e match
:"No such file" -o empty \
51 atf_set descr
"Invalid file"
54 echo "not an object file" >invalid.o
55 atf_check
-s not-exit
:0 -e match
:"not recognized" -o empty \
61 atf_set descr
"Order objects"
64 echo "void a(void) { }" >a.c
65 echo "void a(void); void b(void) { a(); }" >b.c
66 echo "void b(void); void c(void) { b(); }" >c.c
71 echo "b.o a.o" >>output
72 echo "c.o b.o" >>output
73 atf_check
-o file:output \
77 atf_test_case archives
79 atf_set descr
"Order archives"
82 echo "void a(void) { }" >a.c
83 echo "void a(void); void b(void) { a(); }" >b.c
84 echo "void b(void); void c(void) { b(); }" >c.c
85 echo "void e(void); void d(void) { e(); }" >d.c
86 echo "void d(void); void e(void) { d(); }" >e.c
87 for n
in a b c d e
; do
95 echo "z.a z.a" >>output
96 echo "b.a a.a" >>output
97 echo "c.a b.a" >>output
98 atf_check
-o file:output \
102 atf_init_test_cases
()
104 atf_add_test_case noargs
105 atf_add_test_case onearg
106 atf_add_test_case dashdash
107 atf_add_test_case nonexistent
108 atf_add_test_case invalid
109 atf_add_test_case objects
110 atf_add_test_case archives