diff options
author | Eric Blake <eblake@redhat.com> | 2012-03-23 16:04:18 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2012-03-23 16:12:58 -0600 |
commit | 98ada9ab70f28bc492da7a9913666cdb9d2c1915 (patch) | |
tree | da45c29eb6e154ec45daa7a17bef1fa198a6c9c7 | |
parent | build: fix incorrect enum declaration (diff) | |
download | libvirt-98ada9ab70f28bc492da7a9913666cdb9d2c1915.tar.gz libvirt-98ada9ab70f28bc492da7a9913666cdb9d2c1915.tar.bz2 libvirt-98ada9ab70f28bc492da7a9913666cdb9d2c1915.zip |
build: drop obsolete qparams test
Otherwise, 'make check' breaks since commit bc1ff160 deleted
qparams.h. A later patch will ensure that viruri takes over
what qparams used to do.
* tests/qparamtest.c (mymain): Delete, now that we have viruri.
* tests/Makefile.am (check_PROGRAMS, TESTS, qparamtest_SOURCES):
Delete old test.
* .gitignore: Add recent test additions.
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | tests/Makefile.am | 7 | ||||
-rw-r--r-- | tests/qparamtest.c | 228 |
3 files changed, 4 insertions, 234 deletions
diff --git a/.gitignore b/.gitignore index b35e863e6..2f27ff4d4 100644 --- a/.gitignore +++ b/.gitignore @@ -139,11 +139,14 @@ /tests/ssh /tests/statstest /tests/utiltest +/tests/virauthconfigtest /tests/virbuftest /tests/virhashtest +/tests/virkeyfiletest /tests/virnet*test /tests/virshtest /tests/virtimetest +/tests/viruritest /tests/vmx2xmltest /tests/xencapstest /tests/xmconfigtest diff --git a/tests/Makefile.am b/tests/Makefile.am index 0e5ca39bd..4755a3e6e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -92,7 +92,7 @@ EXTRA_DIST = \ .valgrind.supp check_PROGRAMS = virshtest conftest sockettest \ - nodeinfotest qparamtest virbuftest \ + nodeinfotest virbuftest \ commandtest commandhelper seclabeltest \ virhashtest virnetmessagetest virnetsockettest ssh \ utiltest virnettlscontexttest shunloadtest \ @@ -210,7 +210,6 @@ EXTRA_DIST += $(test_scripts) TESTS = virshtest \ nodeinfotest \ - qparamtest \ virbuftest \ sockettest \ commandtest \ @@ -529,10 +528,6 @@ seclabeltest_SOURCES = \ seclabeltest.c seclabeltest_LDADD = ../src/libvirt_driver_security.la $(LDADDS) -qparamtest_SOURCES = \ - qparamtest.c testutils.h testutils.c -qparamtest_LDADD = $(LDADDS) - virbuftest_SOURCES = \ virbuftest.c testutils.h testutils.c virbuftest_LDADD = $(LDADDS) diff --git a/tests/qparamtest.c b/tests/qparamtest.c deleted file mode 100644 index 78551c6e0..000000000 --- a/tests/qparamtest.c +++ /dev/null @@ -1,228 +0,0 @@ -#include <config.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "internal.h" -#include "testutils.h" -#include "qparams.h" -#include "util.h" -#include "memory.h" - -struct qparamParseDataEntry { - const char *name; - const char *value; -}; - -struct qparamParseData { - const char *queryIn; - const char *queryOut; - int nparams; - const struct qparamParseDataEntry *params; -}; - -static int -qparamParseTest(const void *data) -{ - const struct qparamParseData *expect = data; - struct qparam_set *actual = qparam_query_parse(expect->queryIn); - int ret = -1, i; - if (!actual) - return -1; - - if (actual->n != expect->nparams) - goto fail; - - for (i = 0 ; i < actual->n ; i++) { - if (!STREQ(expect->params[i].name, - actual->p[i].name)) - goto fail; - if (!STREQ(expect->params[i].value, - actual->p[i].value)) - goto fail; - } - - ret = 0; - -fail: - free_qparam_set(actual); - return ret; -} - -static int -qparamFormatTest(const void *data) -{ - const struct qparamParseData *expect = data; - struct qparam_set *actual = qparam_query_parse(expect->queryIn); - char *output = NULL; - int ret = -1; - - if (!actual) - return -1; - - output = qparam_get_query(actual); - if (!output) - goto fail; - - if (!STREQ(output, expect->queryOut)) - goto fail; - - ret = 0; - -fail: - VIR_FREE(output); - free_qparam_set(actual); - return ret; -} - -static int -qparamBuildTest(const void *data) -{ - const struct qparamParseData *expect = data; - struct qparam_set *actual = new_qparam_set(0, NULL); - int ret = -1, i; - if (!actual) - return -1; - - for (i = 0 ; i < expect->nparams ; i++) { - if (append_qparam(actual, - expect->params[i].name, - expect->params[i].value) < 0) - goto fail; - } - - if (actual->n != expect->nparams) - goto fail; - - for (i = 0 ; i < actual->n ; i++) { - if (!STREQ(expect->params[i].name, - actual->p[i].name)) - goto fail; - if (!STREQ(expect->params[i].value, - actual->p[i].value)) - goto fail; - } - - ret = 0; - -fail: - free_qparam_set(actual); - return ret; -} - - -static int -qparamTestNewVargs(const void *data ATTRIBUTE_UNUSED) -{ - struct qparam_set *actual = new_qparam_set(0, "foo", "one", "bar", "two", NULL); - int ret = -1; - if (!actual) - return -1; - - if (actual->n != 2) - goto fail; - - if (!STREQ(actual->p[0].name, "foo")) - goto fail; - - if (!STREQ(actual->p[0].value, "one")) - goto fail; - - if (!STREQ(actual->p[1].name, "bar")) - goto fail; - - if (!STREQ(actual->p[1].value, "two")) - goto fail; - - ret = 0; - -fail: - free_qparam_set(actual); - return ret; -} - -static int -qparamTestAddVargs(const void *data ATTRIBUTE_UNUSED) -{ - struct qparam_set *actual = new_qparam_set(0, NULL); - int ret = -1; - if (!actual) - return -1; - - if (append_qparams(actual, "foo", "one", "bar", "two", NULL) < 0) - goto fail; - - if (actual->n != 2) - goto fail; - - if (!STREQ(actual->p[0].name, "foo")) - goto fail; - - if (!STREQ(actual->p[0].value, "one")) - goto fail; - - if (!STREQ(actual->p[1].name, "bar")) - goto fail; - - if (!STREQ(actual->p[1].value, "two")) - goto fail; - - ret = 0; - -fail: - free_qparam_set(actual); - return ret; -} - -static const struct qparamParseDataEntry params1[] = { { "foo", "one" }, { "bar", "two" } }; -static const struct qparamParseDataEntry params2[] = { { "foo", "one" }, { "foo", "two" } }; -static const struct qparamParseDataEntry params3[] = { { "foo", "&one" }, { "bar", "&two" } }; -static const struct qparamParseDataEntry params4[] = { { "foo", "" } }; -static const struct qparamParseDataEntry params5[] = { { "foo", "one two" } }; -static const struct qparamParseDataEntry params6[] = { { "foo", "one" } }; - -static int -mymain(void) -{ - int ret = 0; - -#define DO_TEST(queryIn,queryOut,params) \ - do { \ - struct qparamParseData info = { \ - queryIn, \ - queryOut ? queryOut : queryIn, \ - ARRAY_CARDINALITY(params), \ - params }; \ - if (virtTestRun("Parse " queryIn, \ - 1, qparamParseTest, &info) < 0) \ - ret = -1; \ - if (virtTestRun("Format " queryIn, \ - 1, qparamFormatTest, &info) < 0) \ - ret = -1; \ - if (virtTestRun("Build " queryIn, \ - 1, qparamBuildTest, &info) < 0) \ - ret = -1; \ - } while (0) - - - DO_TEST("foo=one&bar=two", NULL, params1); - DO_TEST("foo=one&foo=two", NULL, params2); - DO_TEST("foo=one&&foo=two", "foo=one&foo=two", params2); - DO_TEST("foo=one;foo=two", "foo=one&foo=two", params2); - DO_TEST("foo", "foo=", params4); - DO_TEST("foo=", NULL, params4); - DO_TEST("foo=&", "foo=", params4); - DO_TEST("foo=&&", "foo=", params4); - DO_TEST("foo=one%20two", NULL, params5); - DO_TEST("=bogus&foo=one", "foo=one", params6); - - if (virtTestRun("New vargs", 1, qparamTestNewVargs, NULL) < 0) - ret = -1; - if (virtTestRun("Add vargs", 1, qparamTestAddVargs, NULL) < 0) - ret = -1; - - return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE); -} - -VIRT_TEST_MAIN(mymain) |