summaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'trunk')
-rw-r--r--trunk/src/equery/tests/common-functions.sh9
-rwxr-xr-xtrunk/src/equery/tests/test-belongs.sh24
-rwxr-xr-xtrunk/src/equery/tests/test-check.sh27
-rwxr-xr-xtrunk/src/equery/tests/test-depends.sh27
-rwxr-xr-xtrunk/src/equery/tests/test-depgraph.sh27
-rwxr-xr-xtrunk/src/equery/tests/test-list.sh39
-rwxr-xr-xtrunk/src/equery/tests/test-size.sh27
-rwxr-xr-xtrunk/src/equery/tests/test-uses.sh39
-rwxr-xr-xtrunk/src/equery/tests/test-which.sh22
9 files changed, 241 insertions, 0 deletions
diff --git a/trunk/src/equery/tests/common-functions.sh b/trunk/src/equery/tests/common-functions.sh
index 125517f..f065a0a 100644
--- a/trunk/src/equery/tests/common-functions.sh
+++ b/trunk/src/equery/tests/common-functions.sh
@@ -40,4 +40,13 @@ function assert_ge() {
printf "FAIL: $2 ! -ge $3\n"
report_failure $1
fi
+}
+
+function assert_exists() {
+ if [ -f $2 ] ; then
+ report_pass $1
+ else
+ printf "FAIL: $2 does not exist\n"
+ report_failure $1
+ fi
} \ No newline at end of file
diff --git a/trunk/src/equery/tests/test-belongs.sh b/trunk/src/equery/tests/test-belongs.sh
new file mode 100755
index 0000000..bd0eac4
--- /dev/null
+++ b/trunk/src/equery/tests/test-belongs.sh
@@ -0,0 +1,24 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_belongs() {
+ equery belongs $(which gcc) > ${tmpfile}
+
+ x=$(grep "gcc-config" ${tmpfile} | wc -l)
+
+ assert_eq ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+test_belongs
+
+rm -f ${tmpfile} \ No newline at end of file
diff --git a/trunk/src/equery/tests/test-check.sh b/trunk/src/equery/tests/test-check.sh
new file mode 100755
index 0000000..3608ce4
--- /dev/null
+++ b/trunk/src/equery/tests/test-check.sh
@@ -0,0 +1,27 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_check() {
+ equery check gcc > ${tmpfile}
+
+ x=$(grep "sys-devel/gcc" ${tmpfile} | wc -l)
+
+ assert_ge ${FUNCNAME} ${x} 1
+
+ x=$(egrep "[0-9]+ out of [0-9]+" ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+test_check
+
+rm -f ${tmpfile} \ No newline at end of file
diff --git a/trunk/src/equery/tests/test-depends.sh b/trunk/src/equery/tests/test-depends.sh
new file mode 100755
index 0000000..a70dcfc
--- /dev/null
+++ b/trunk/src/equery/tests/test-depends.sh
@@ -0,0 +1,27 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_depends() {
+# equery skel gcc > ${tmpfile}
+
+# x=$(grep "app-shells/bash" ${tmpfile} | wc -l)
+
+# assert_eq ${FUNCNAME} ${x} 1
+
+# x=$(grep "virtual/libc" ${tmpfile} | wc -l)
+# assert_eq ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+#test_skel
+
+rm -f ${tmpfile} \ No newline at end of file
diff --git a/trunk/src/equery/tests/test-depgraph.sh b/trunk/src/equery/tests/test-depgraph.sh
new file mode 100755
index 0000000..016bb37
--- /dev/null
+++ b/trunk/src/equery/tests/test-depgraph.sh
@@ -0,0 +1,27 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_depgraph() {
+ equery depgraph gcc > ${tmpfile}
+
+ x=$(grep "app-shells/bash" ${tmpfile} | wc -l)
+
+ assert_eq ${FUNCNAME} ${x} 1
+
+ x=$(grep "virtual/libc" ${tmpfile} | wc -l)
+ assert_eq ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+test_depgraph
+
+rm -f ${tmpfile} \ No newline at end of file
diff --git a/trunk/src/equery/tests/test-list.sh b/trunk/src/equery/tests/test-list.sh
new file mode 100755
index 0000000..fae5426
--- /dev/null
+++ b/trunk/src/equery/tests/test-list.sh
@@ -0,0 +1,39 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_list() {
+ equery list > ${tmpfile}
+
+ pkgs=$(cat ${tmpfile} | wc -l)
+ x=$(grep "[I--]" ${tmpfile} | wc -l)
+ assert_eq ${FUNCNAME} ${pkgs} ${x]
+
+ x=$(grep "app-shells/bash" | wc -l)
+ assert_ge ${FUNCNAME} $x 1
+}
+
+test_list_installed() {
+ test_list
+}
+
+test_list_portage_tree() {
+ equery list -I -p > ${tmpfile}
+}
+
+test_list_overlay_tree() {
+ equery list -I -o > ${tmpfile}
+}
+
+# Run tests
+
+test_list
+
+rm -f ${tmpfile} \ No newline at end of file
diff --git a/trunk/src/equery/tests/test-size.sh b/trunk/src/equery/tests/test-size.sh
new file mode 100755
index 0000000..126a5db
--- /dev/null
+++ b/trunk/src/equery/tests/test-size.sh
@@ -0,0 +1,27 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_size() {
+ equery size gcc > ${tmpfile}
+
+ x=$(grep "sys-devel/gcc" ${tmpfile} | wc -l)
+
+ assert_ge ${FUNCNAME} ${x} 1
+
+ x=$(egrep "size\([0-9]+\)" ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+test_size
+
+rm -f ${tmpfile} \ No newline at end of file
diff --git a/trunk/src/equery/tests/test-uses.sh b/trunk/src/equery/tests/test-uses.sh
new file mode 100755
index 0000000..f03e786
--- /dev/null
+++ b/trunk/src/equery/tests/test-uses.sh
@@ -0,0 +1,39 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_uses() {
+ equery uses gcc > ${tmpfile}
+
+ x=$(grep "static" ${tmpfile} | wc -l)
+
+ assert_eq ${FUNCNAME} ${x} 1
+
+ x=$(cat ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} $x 7
+}
+
+test_uses_all() {
+ equery uses -a uclibc > ${tmpfile}
+
+ x=$(grep "static" ${tmpfile} | wc -l)
+ assert_eq ${FUNCNAME} ${pkgs} ${x]
+
+ x=$(cat ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} $x 5
+
+}
+
+# Run tests
+
+test_uses
+test_uses_all
+
+rm -f ${tmpfile} \ No newline at end of file
diff --git a/trunk/src/equery/tests/test-which.sh b/trunk/src/equery/tests/test-which.sh
new file mode 100755
index 0000000..491868f
--- /dev/null
+++ b/trunk/src/equery/tests/test-which.sh
@@ -0,0 +1,22 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_which() {
+ file=$(equery which gcc)
+
+ assert_exists ${FUNCNAME} ${file}
+}
+
+# Run tests
+
+test_which
+
+rm -f ${tmpfile} \ No newline at end of file