/ tests / frontend / clean.sh
clean.sh
 1  #! /usr/bin/env atf-sh
 2  
 3  . $(atf_get_srcdir)/test_environment.sh
 4  
 5  tests_init \
 6  	basic
 7  
 8  basic_body() {
 9  	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "1"
10  
11  	atf_check \
12  		-o empty \
13  		-e empty \
14  		-s exit:0 \
15  		pkg create -M test.ucl
16  	mkdir -p ${TMPDIR}/target
17  	atf_check \
18  		-e empty \
19  		-o ignore \
20  		-s exit:0 \
21  		pkg -o REPOS_DIR=/dev/null -r ${TMPDIR}/target install -qfy ${TMPDIR}/test-1.pkg
22  
23  	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "2"
24  
25  	atf_check \
26  		-o empty \
27  		-e empty \
28  		-s exit:0 \
29  		pkg create -M test.ucl
30  	atf_check \
31  		-o ignore \
32  		-e empty \
33  		-s exit:0 \
34  		pkg repo .
35  	mkdir reposconf
36  	cat <<EOF >> reposconf/repo.conf
37  local: {
38  	url: file:///${TMPDIR},
39  	enabled: true
40  }
41  EOF
42  	atf_check \
43  		-e empty \
44  		-o ignore \
45  		-s exit:0 \
46  		pkg -o REPOS_DIR="${TMPDIR}/reposconf" update
47  
48  	mkdir cache
49  	mv test-* cache
50  	atf_check \
51  		-e empty \
52  		-o match:"test-.\.pkg" \
53  		-s exit:0 \
54  		pkg -C /dev/null -o PKG_CACHEDIR=${TMPDIR}/cache -o REPOS_DIR="${TMPDIR}/reposconf" clean -n
55  }
56