/ tests / frontend / version.sh
version.sh
 1  #! /usr/bin/env atf-sh
 2  
 3  . $(atf_get_srcdir)/test_environment.sh
 4  
 5  tests_init \
 6  	version \
 7  	compare \
 8  	compare_ge_le
 9  
10  version_body() {
11  	atf_check -o inline:"<\n" -s exit:0 pkg version -t 1 2
12  	atf_check -o inline:">\n" -s exit:0 pkg version -t 2 1
13  	atf_check -o inline:"=\n" -s exit:0 pkg version -t 2 2
14  	atf_check -o inline:"<\n" -s exit:0 pkg version -t 2 1,1
15  	# Special prefixes
16  	atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.pl1 1.alpha1
17  	atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.alpha1 1.beta1
18  	atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.beta1 1.pre1
19  	atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.pre1 1.rc1
20  	atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.rc1 1
21  
22  	atf_check -o inline:"<\n" -s exit:0 pkg version -t 1.pl1 1.snap1
23  	atf_check -o inline:">\n" -s exit:0 pkg version -t 1.snap1 1.alpha1
24  }
25  
26  compare_body() {
27  	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg test test 5.20_3
28  
29  	atf_check \
30  		-o match:".*Installing.*" \
31  		pkg register -M test.ucl
32  	atf_check \
33  		-o ignore \
34  		pkg info "test>0"
35  	atf_check \
36  		-o ignore \
37  		-e ignore \
38  		-s exit:1 \
39  		pkg info "test<5"
40  	atf_check \
41  		-o ignore \
42  		pkg info "test>5<6"
43  	atf_check \
44  		-o ignore \
45  		-e ignore \
46  		-s exit:1 \
47  		pkg info "test>5<5.20"
48  	atf_check \
49  		-o ignore \
50  		-e ignore \
51  		-s exit:1 \
52  		pkg info "test>5.20_3<6"
53  }
54  
55  compare_ge_le_body() {
56  	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg test test 5.20_3
57  
58  	atf_check \
59  		-o match:".*Installing.*" \
60  		pkg register -M test.ucl
61  	atf_check \
62  		-o ignore \
63  		pkg info "test>=5.20_3"
64  	atf_check \
65  		-o ignore \
66  		pkg info "test<=5.20_3"
67  	atf_check \
68  		-o ignore \
69  		pkg info "test>=5"
70  	atf_check \
71  		-o ignore \
72  		-e ignore \
73  		-s exit:1 \
74  		pkg info "test>=6"
75  	atf_check \
76  		-o ignore \
77  		-e ignore \
78  		-s exit:1 \
79  		pkg info "test<=5"
80  	atf_check \
81  		-o ignore \
82  		pkg info "test>=5<=6"
83  }