summaryrefslogtreecommitdiff
path: root/tests/rpmquery.at
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-12-04 21:23:06 +0200
committerPanu Matilainen <pmatilai@redhat.com>2008-12-04 21:23:06 +0200
commitc0e6b4579fa0e392dd2de1d4aa0245983c58ae06 (patch)
tree8de64a5333a6a9d5c364f54ee9162bd8b57141b8 /tests/rpmquery.at
parentba87a938b77c7ab9ffa4cca1255a877600ba2305 (diff)
downloadrpm-c0e6b4579fa0e392dd2de1d4aa0245983c58ae06.tar.gz
rpm-c0e6b4579fa0e392dd2de1d4aa0245983c58ae06.tar.bz2
rpm-c0e6b4579fa0e392dd2de1d4aa0245983c58ae06.zip
Add a pile of queryformat tests
- a few fail, and for a reason (rhbz#474550 and breakage from tag class changes)
Diffstat (limited to 'tests/rpmquery.at')
-rw-r--r--tests/rpmquery.at197
1 files changed, 197 insertions, 0 deletions
diff --git a/tests/rpmquery.at b/tests/rpmquery.at
index 162b6a72d..c6ce75482 100644
--- a/tests/rpmquery.at
+++ b/tests/rpmquery.at
@@ -142,3 +142,200 @@ runroot rpm \
[ignore])
AT_CLEANUP
+
+# ------------------------------
+AT_SETUP([integer array query])
+AT_KEYWORDS([query])
+AT_CHECK([
+run rpm \
+ --queryformat="[[%{filemodes}\n]]" \
+ -qp "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
+],
+[0],
+[33257
+16877
+33188
+],
+[])
+AT_CLEANUP
+
+# ------------------------------
+AT_SETUP([formatted filesbypkg query])
+AT_KEYWORDS([query])
+AT_CHECK([
+run rpm \
+ --queryformat="[[%-10{=NAME} %{FILENAMES}\n]]" \
+ -qp "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
+],
+[0],
+[hello /usr/local/bin/hello
+hello /usr/share/doc/hello-1.0
+hello /usr/share/doc/hello-1.0/FAQ
+],
+[])
+AT_CLEANUP
+
+# ------------------------------
+AT_SETUP([hex formatted integer array extension query])
+AT_KEYWORDS([query])
+AT_CHECK([
+run rpm \
+ --queryformat="[[%5{longfilesizes:hex}\n]]" \
+ -qp "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
+],
+[0],
+[ b40
+ 1000
+ 24
+],
+[])
+AT_CLEANUP
+
+# ------------------------------
+AT_SETUP([base64 extension query])
+AT_KEYWORDS([query])
+AT_CHECK([
+run rpm \
+ --queryformat="%{pkgid:base64}" \
+ -qp "${abs_srcdir}"/data/RPMS/foo-1.0-1.noarch.rpm
+],
+[0],
+[qt8W635v5FKy1pILrW+0uw==
+],
+[])
+AT_CLEANUP
+
+# ------------------------------
+AT_SETUP([integer array perms format query])
+AT_KEYWORDS([query])
+AT_CHECK([
+run rpm \
+ --queryformat="[[%{filemodes:perms}\n]]" \
+ -qp "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
+],
+[0],
+[-rwxr-x--x
+drwxr-xr-x
+-rw-r--r--
+],
+[])
+AT_CLEANUP
+
+# ------------------------------
+AT_SETUP([string array query])
+AT_KEYWORDS([query])
+AT_CHECK([
+run rpm \
+ --queryformat="[[%{basenames} ]]" \
+ -qp "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
+],
+[0],
+[hello hello-1.0 FAQ ],
+[])
+AT_CLEANUP
+
+# ------------------------------
+AT_SETUP([empty string array extension array query])
+AT_KEYWORDS([query])
+AT_CHECK([
+run rpm \
+ --queryformat="[[%{filenames}]]" \
+ -qp "${abs_srcdir}"/data/RPMS/foo-1.0-1.noarch.rpm
+],
+[0],
+[],
+[])
+AT_CLEANUP
+
+# ------------------------------
+AT_SETUP([empty string array extension query])
+AT_KEYWORDS([query])
+AT_CHECK([
+run rpm \
+ --queryformat="%{filenames}" \
+ -qp "${abs_srcdir}"/data/RPMS/foo-1.0-1.noarch.rpm
+],
+[0],
+[(none)],
+[])
+AT_CLEANUP
+
+# ------------------------------
+AT_SETUP([different sizes arrays query])
+AT_KEYWORDS([query])
+AT_CHECK([
+run rpm \
+ --queryformat="[[%{basenames} %{changelogname}]]" \
+ -qp "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
+],
+[0],
+[],
+[error: incorrect format: array iterator used with different sized arrays
+])
+AT_CLEANUP
+
+# ------------------------------
+AT_SETUP([non-existent string tag])
+AT_KEYWORDS([query])
+AT_CHECK([
+run rpm \
+ --queryformat="%{vendor}" \
+ -qp "${abs_srcdir}"/data/RPMS/foo-1.0-1.noarch.rpm
+],
+[0],
+[(none)],
+[])
+AT_CLEANUP
+
+# ------------------------------
+AT_SETUP([non-existent integer tag query])
+AT_KEYWORDS([query])
+AT_CHECK([
+run rpm \
+ --queryformat="%{installcolor}" \
+ -qp "${abs_srcdir}"/data/RPMS/foo-1.0-1.noarch.rpm
+],
+[0],
+[(none)],
+[])
+AT_CLEANUP
+
+# ------------------------------
+AT_SETUP([conditional queryformat])
+AT_KEYWORDS([query])
+AT_CHECK([
+run rpm \
+ --queryformat="%|name?{%{name}}:{no}| %|installtime?{%{installtime}}:{(not installed)}|" \
+ -qp "${abs_srcdir}"/data/RPMS/foo-1.0-1.noarch.rpm
+],
+[0],
+[foo (not installed)],
+[])
+AT_CLEANUP
+
+# ------------------------------
+AT_SETUP([invalid tag query])
+AT_KEYWORDS([query])
+AT_CHECK([
+run rpm \
+ --queryformat="%{notag}" \
+ -qp "${abs_srcdir}"/data/RPMS/foo-1.0-1.noarch.rpm
+],
+[0],
+[],
+[error: incorrect format: unknown tag
+])
+AT_CLEANUP
+
+# ------------------------------
+AT_SETUP([invalid data for format query])
+AT_KEYWORDS([query])
+AT_CHECK([
+run rpm \
+ --queryformat="%{name:depflags}" \
+ -qp "${abs_srcdir}"/data/RPMS/foo-1.0-1.noarch.rpm
+],
+[0],
+[(not a number)],
+[])
+AT_CLEANUP