Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Cleanup a bit tests
Baptiste Daroussin committed 11 years ago
commit 5ff61b6251bb70fba6f6452cd742af896bc0515d
parent d0726aa
14 files changed +27 -118
modified tests/frontend/add.shin
@@ -1,13 +1,6 @@
#! /usr/bin/env atf-sh

initialize_pkg() {
-
	export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
-

-
	jailed=$(sysctl -n security.jail.jailed || :)
-
	if [ "$jailed" = "1" ]; then
-
		JAILED="[`hostname`] "
-
	fi
	touch a
	cat << EOF > test.ucl
name: test
@@ -119,13 +112,6 @@ add_accept_missing_head() {
	atf_set "descr" "pkg add -M"
}
add_accept_missing_body() {
-
	export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
-

-
	jailed=$(sysctl -n security.jail.jailed || :)
-
	if [ "$jailed" = "1" ]; then
-
		JAILED="[`hostname`] "
-
	fi
	touch a
	cat << EOF > test.ucl
name: test
@@ -220,13 +206,6 @@ add_stdin_body_head() {
}

add_stdin_missing_body() {
-
	export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
-

-
	jailed=$(sysctl -n security.jail.jailed || :)
-
	if [ "$jailed" = "1" ]; then
-
		JAILED="[`hostname`] "
-
	fi
	touch a
	cat << EOF > test.ucl
name: test
modified tests/frontend/annotate.shin
@@ -8,9 +8,6 @@ annotate_head() {
}

annotate_body() {
-
        export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
-

	for pkg in 'png' 'sqlite3' ; do
	    atf_check \
		-o match:".*Installing.*\.\.\.$" \
modified tests/frontend/conflicts.shin
@@ -5,8 +5,6 @@ find_conflicts_head() {
}

find_conflicts_body() {
-
	export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
	touch a
	cat << EOF >> manifest
name: test
@@ -68,10 +66,6 @@ local: {
}
EOF

-
	jailed=$(sysctl -n security.jail.jailed || :)
-
	if [ "$jailed" = "1" ]; then
-
		JAILED="[`hostname`] "
-
	fi
OUTPUT="Updating local repository catalogue...
${JAILED}Fetching meta.txz... done
${JAILED}Fetching packagesite.txz... done
modified tests/frontend/create.shin
@@ -29,9 +29,6 @@ EOF
}

preparetestcredentials() {
-
	export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
-

	touch file1

	genmanifest
@@ -44,10 +41,6 @@ basic_validation() {
}

create_from_plist_body() {
-
	export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
-

-
	TMPDIR=`pwd`
	touch file1
	genmanifest
	genplist "file1"
@@ -187,9 +180,6 @@ create_from_plist_dirrm_head() {
}

create_from_plist_dirrm_body() {
-
	export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
-

	mkdir testdir

	genmanifest
@@ -216,8 +206,6 @@ create_from_plist_ignore_head() {
	atf_set "descr" "Testing @ignore"
}
create_from_plist_ignore_body() {
-
	export INSTALL_AS_USER=yes
-

	genmanifest
	genplist "@ignore
aline"
modified tests/frontend/delete.shin
@@ -6,10 +6,6 @@ simple_delete_head() {
}

simple_delete_body() {
-
	export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
-

-
	tmpdir=`pwd`
	touch file1
	mkdir dir
	touch dir/file2
@@ -22,13 +18,13 @@ maintainer: test
categories: [test]
comment: a test
www: http://test
-
prefix: ${tmpdir}
+
prefix: ${TMPDIR}
desc: <<EOD
Yet another test
EOD
files: {
-
    ${tmpdir}/file1: "",
-
    ${tmpdir}/dir/file2: "",
+
    ${TMPDIR}/file1: "",
+
    ${TMPDIR}/dir/file2: "",
}
EOF

@@ -47,7 +43,7 @@ EOF
	test -f file1 && atf_fail "'file1' still present"
	test -f dir/file2 && atf_fail "'dir/file2' still present"
	test -d dir && atf_fail "'dir' still present"
-
	test -d ${tmpdir} || atf_fail "Prefix have been removed"
+
	test -d ${TMPDIR} || atf_fail "Prefix have been removed"
}

atf_test_case simple_delete_prefix_ending_with_slash
@@ -56,10 +52,6 @@ simple_delete_prefix_ending_with_slash_head() {
}

simple_delete_prefix_ending_with_slash_body() {
-
	export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
-

-
	tmpdir=`pwd`
	touch file1
	mkdir dir
	touch dir/file2
@@ -72,13 +64,13 @@ maintainer: test
categories: [test]
comment: a test
www: http://test
-
prefix: ${tmpdir}/
+
prefix: ${TMPDIR}/
desc: <<EOD
Yet another test
EOD
files: {
-
    ${tmpdir}/file1: "",
-
    ${tmpdir}/dir/file2: "",
+
    ${TMPDIR}/file1: "",
+
    ${TMPDIR}/dir/file2: "",
}
EOF

@@ -97,7 +89,7 @@ EOF
	test -f file1 && atf_fail "'file1' still present"
	test -f dir/file2 && atf_fail "'dir/file2' still present"
	test -d dir && atf_fail "'dir' still present"
-
	test -d ${tmpdir} || atf_fail "Prefix have been removed"
+
	test -d ${TMPDIR} || atf_fail "Prefix have been removed"
}

atf_test_case delete_with_directory_owned
@@ -106,10 +98,6 @@ delete_with_directory_owned_head() {
}

delete_with_directory_owned_body() {
-
	export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
-

-
	tmpdir=`pwd`
	touch file1
	mkdir dir
	touch dir/file2
@@ -122,13 +110,13 @@ maintainer: test
categories: [test]
comment: a test
www: http://test
-
prefix: ${tmpdir}/
+
prefix: ${TMPDIR}/
desc: <<EOD
Yet another test
EOD
files: {
-
    ${tmpdir}/file1: "",
-
    ${tmpdir}/dir/file2: "",
+
    ${TMPDIR}/file1: "",
+
    ${TMPDIR}/dir/file2: "",
}
EOF

@@ -140,12 +128,12 @@ maintainer: test
categories: [test]
comment: a test
www: http://test
-
prefix: ${tmpdir}/
+
prefix: ${TMPDIR}/
desc: <<EOD
Yet another test
EOD
directories: {
-
    ${tmpdir}/dir: 'y',
+
    ${TMPDIR}/dir: 'y',
}
EOF
	atf_check \
@@ -177,7 +165,7 @@ EOF
		pkg delete -y test2

	test -d dir && atf_fail "'dir' still present"
-
	test -d ${tmpdir} || atf_fail "Prefix has been removed"
+
	test -d ${TMPDIR} || atf_fail "Prefix has been removed"
}

atf_init_test_cases() {
modified tests/frontend/lock.shin
@@ -8,9 +8,6 @@ lock_head() {
}

lock_body() {
-
        export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
-

	for pkg in 'png' 'sqlite3' ; do
	    atf_check \
		-o match:".*Installing.*\.\.\.$" \
modified tests/frontend/packagesplit.shin
@@ -6,10 +6,6 @@ package_split_head() {
}

package_split_body() {
-
	export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
-

-
	tmpdir=`pwd`
	touch file1
	touch file2

@@ -26,8 +22,8 @@ desc: <<EOD
Yet another test
EOD
files: {
-
    ${tmpdir}/file1: "",
-
    ${tmpdir}/file2: "",
+
    ${TMPDIR}/file1: "",
+
    ${TMPDIR}/file2: "",
}
EOF

@@ -64,7 +60,7 @@ desc: <<EOD
Yet another test
EOD
files: {
-
	${tmpdir}/file1: "",
+
	${TMPDIR}/file1: "",
}
EOF

@@ -81,7 +77,7 @@ desc: <<EOD
Yet another test
EOD
files: {
-
	${tmpdir}/file2: "",
+
	${TMPDIR}/file2: "",
}
EOF

@@ -133,7 +129,7 @@ EOF

	cat << EOF >> repo.conf
local: {
-
	url: file:///$tmpdir,
+
	url: file:///$TMPDIR,
	enabled: true
}
EOF
@@ -141,7 +137,7 @@ EOF
		-o ignore \
		-e empty \
		-s exit:0 \
-
		pkg -o REPOS_DIR="$tmpdir" -o PKG_CACHEDIR="$tmpdir" upgrade -y
+
		pkg -o REPOS_DIR="$TMPDIR" -o PKG_CACHEDIR="$TMPDIR" upgrade -y

	test -f file1 || atf_fail "file1 is not present"
}
modified tests/frontend/register.shin
@@ -6,9 +6,6 @@ register_conflicts_head() {
}

register_conflicts_body() {
-
	export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
-

	mkdir teststage
	echo a > teststage/plop
	sum=$(openssl dgst -sha256 -binary teststage/plop | hexdump -v -e '/1 "%x"')
@@ -62,8 +59,5 @@ EOF

atf_init_test_cases() {
	. $(atf_get_srcdir)/test_environment.sh
-

-
	unset PKG_DBDIR
-

	atf_add_test_case register_conflicts
}
modified tests/frontend/requires.shin
@@ -6,9 +6,6 @@ requires_head() {
}

requires_body() {
-
	export PKG_DBDIR=.
-
	export INSTALL_AS_USER=yes
-

	cat << EOF >> repo.conf
local1: {
	url: file://${TMPDIR},
@@ -59,10 +56,6 @@ EOF
		-s exit:0 \
		pkg repo .

-
	jailed=$(sysctl -n security.jail.jailed || :)
-
	if [ "$jailed" = "1" ]; then
-
		JAILED="[`hostname`] "
-
	fi
OUTPUT="Updating local1 repository catalogue...
${JAILED}Fetching meta.txz... done
${JAILED}Fetching packagesite.txz... done
modified tests/frontend/rubypuppet.shin
@@ -11,10 +11,6 @@ pkg_puppet_head() {
}

pkg_puppet_body() {
-

-
	export PKG_DBDIR=.
-
	export INSTALL_AS_USER=yes
-

	touch puppet.file
	touch ruby.file
	touch rubygemrubyaugeas.file
@@ -354,10 +350,6 @@ local: {
}
EOF

-
	jailed=$(sysctl -n security.jail.jailed || :)
-
	if [ "$jailed" = "1" ]; then
-
		JAILED="[`hostname`] "
-
	fi
OUTPUT="Updating local repository catalogue...
${JAILED}Fetching meta.txz... done
${JAILED}Fetching packagesite.txz... done
modified tests/frontend/search.shin
@@ -7,15 +7,10 @@ search_head() {

search_body() {
	export REPOS_DIR=/nonexistent
-
	export PKG_DBDIR=.
-
	export INSTALL_AS_USER=yes
	atf_check -e inline:"No active remote repositories configured.\n" -o empty -s exit:3 pkg -C '' -R '' search -e -Q comment -S name pkg
}

atf_init_test_cases() {
        . $(atf_get_srcdir)/test_environment.sh
-

-
	unset PKG_DBDIR
-

	atf_add_test_case search
}
modified tests/frontend/set.shin
@@ -1,13 +1,6 @@
#! /usr/bin/env atf-sh

initialize_pkg() {
-
	export INSTALL_AS_USER=yes
-
	export PKG_DBDIR=.
-

-
	jailed=$(sysctl -n security.jail.jailed || :)
-
	if [ "$jailed" = "1" ]; then
-
		JAILED="[`hostname`] "
-
	fi
	cat << EOF > test.ucl
name: test
origin: origin/test
@@ -32,8 +25,6 @@ EOF

atf_test_case set_automatic
set_automatic_body() {
-
	export INSTALL_AS_USER=yes
-

	initialize_pkg

	atf_check \
modified tests/frontend/test_environment.shin
@@ -1,2 +1,8 @@
export PATH=$(atf_get_srcdir)/../../src:${PATH}
export LD_LIBRARY_PATH=$(atf_get_srcdir)/../../libpkg/.libs/
+
export INSTALL_AS_USER=yes
+
export PKG_DBDIR=.
+
jailed=$(sysctl -n security.jail.jailed || :)
+
if [ "$jailed" = "1" ]; then
+
	export JAILED="[`hostname`] "
+
fi
modified tests/frontend/version.shin
@@ -13,7 +13,6 @@ version_body() {
}

atf_init_test_cases() {
-
        . $(atf_get_srcdir)/test_environment.sh
-

+
	. $(atf_get_srcdir)/test_environment.sh
	atf_add_test_case version
}