aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJason Woodward2011-05-19 22:36:34 +0000
committerJason Woodward2011-05-19 23:36:47 +0000
commitf3b0e45112532df817ec59f1240714b629d03082 (patch)
tree31921030331ae2c73b8b3213c5d20d441d44b80f /t
parentc9f97bda6abde6e03dc7574cd510f422c6c068c4 (diff)
downloadslapt-get-f3b0e45112532df817ec59f1240714b629d03082.tar.gz
updating unit tests
Diffstat (limited to 't')
-rw-r--r--t/Makefile6
-rw-r--r--t/data/rc12
-rw-r--r--t/test.c4
-rw-r--r--t/test_configuration.c16
-rw-r--r--t/test_packages.c50
5 files changed, 42 insertions, 36 deletions
diff --git a/t/Makefile b/t/Makefile
index dd4df3f..66c7f77 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -2,7 +2,7 @@ TESTOBJS=test.o test_common.o test_configuration.o test_curl.o test_packages.o t
CC=gcc
CURLFLAGS=`curl-config --libs`
GPGMEFLAGS=`gpgme-config --libs`
-DEFINES=
+DEFINES=-DSLAPTTESTDIR=$(shell pwd) -DSLAPT_HAS_GPGME
CFLAGS=-W -Werror -Wall -O2 -ansi -pedantic $(DEFINES)
LDFLAGS=$(CURLFLAGS) $(GPGMEFLAGS) -lz
CHECKFLAGS=`pkg-config --libs check`
@@ -11,7 +11,9 @@ test: $(TESTOBJS)
$(CC) -o test $(TESTOBJS) $(CFLAGS) ../src/libslapt.so $(CHECKFLAGS) $(LDFLAGS)
runtest: test
- ./test
+ sed -i.bak -re 's|(WORKINGDIR=)([^\/]+.*)|\1$(shell pwd)/\2|' data/rc1
+ ./test || (mv -f data/rc1.bak data/rc1 || exit 1)
+ mv -f data/rc1.bak data/rc1
$(TESTOBJS):
diff --git a/t/data/rc1 b/t/data/rc1
index 15c0129..88c896c 100644
--- a/t/data/rc1
+++ b/t/data/rc1
@@ -1,3 +1,3 @@
WORKINGDIR=data/slapt-get
EXCLUDE=^kernel-.*,^alsa-.*,^glibc.*,.*-[0-9]+dl$,^devs$,^udev$,aaa_elflibs,x86_64
-SOURCE=http://software.jaos.org/slackpacks/12.1/
+SOURCE=http://software.jaos.org/slackpacks/13.37/
diff --git a/t/test.c b/t/test.c
index 2834f63..7c780d9 100644
--- a/t/test.c
+++ b/t/test.c
@@ -55,6 +55,10 @@ int main(void)
Suite *s = slapt_test_suite();
SRunner *sr = srunner_create (s);
+#ifdef SLAPT_HAS_GPGME
+ gpgme_check_version (NULL);
+#endif
+
srunner_add_suite(sr, common_test_suite());
srunner_add_suite(sr, configuration_test_suite());
srunner_add_suite(sr, curl_test_suite());
diff --git a/t/test_configuration.c b/t/test_configuration.c
index 5a3d150..18b8f76 100644
--- a/t/test_configuration.c
+++ b/t/test_configuration.c
@@ -13,8 +13,8 @@ START_TEST (test_struct_config)
rc = slapt_read_rc_config("./data/rc1");
fail_if (rc == NULL);
{
- struct slapt_source_list *s = rc->sources;
- struct slapt_exclude_list *e = rc->exclude_list;
+ slapt_source_list_t *s = rc->sources;
+ slapt_list_t *e = rc->exclude_list;
fail_if (s->count < 1);
fail_if (e->count != 8);
@@ -47,21 +47,21 @@ END_TEST
START_TEST (test_exclude_list)
{
- struct slapt_exclude_list *e = slapt_init_exclude_list();
+ slapt_list_t *e = slapt_init_list();
fail_if (e == NULL);
fail_if (e->count != 0);
- slapt_add_exclude(e,"^foo$");
+ slapt_add_list_item(e,"^foo$");
fail_if (e->count != 1);
- slapt_remove_exclude(e,"^foo$");
+ slapt_remove_list_item(e,"^foo$");
fail_if (e->count != 0);
- slapt_remove_exclude(e,"no_such_exclude");
+ slapt_remove_list_item(e,"no_such_exclude");
fail_if (e->count != 0);
- slapt_free_exclude_list(e);
+ slapt_free_list(e);
}
END_TEST
@@ -69,7 +69,7 @@ END_TEST
START_TEST (test_source_list)
{
slapt_source_t *src = slapt_init_source("http://www.test.org/dist");
- struct slapt_source_list *s = slapt_init_source_list();
+ slapt_source_list_t *s = slapt_init_source_list();
fail_if (s == NULL);
fail_if (s->count != 0);
diff --git a/t/test_packages.c b/t/test_packages.c
index 314b046..9c19ecb 100644
--- a/t/test_packages.c
+++ b/t/test_packages.c
@@ -55,9 +55,9 @@ START_TEST (test_pkg_info)
fail_unless (strcmp(string,"http://software.jaos.org/slackpacks/11.0/./gslapt-0.3.15-i386-1.tgz") == 0);
free(string); string = NULL;
- slapt_add_exclude(rc->exclude_list,"^gslapt$");
+ slapt_add_list_item(rc->exclude_list,"^gslapt$");
fail_if (slapt_is_excluded(rc,&pkg) == 0);
- slapt_remove_exclude(rc->exclude_list,"^gslapt$");
+ slapt_remove_list_item(rc->exclude_list,"^gslapt$");
fail_unless (slapt_download_pkg(rc, &pkg, NULL) == 0);
fail_unless (slapt_verify_downloaded_pkg(rc,&pkg) == 0);
@@ -86,7 +86,7 @@ END_TEST
START_TEST (test_pkg_list)
{
- struct slapt_pkg_list *list = slapt_init_pkg_list();
+ slapt_pkg_list_t *list = slapt_init_pkg_list();
fail_if (list == NULL);
fail_unless (list->pkg_count == 0);
@@ -104,26 +104,26 @@ START_TEST (test_pkg_list)
/* parse the PACKAGES.TXT file
- struct slapt_pkg_list *slapt_parse_packages_txt(FILE *);
+ slapt_pkg_list_t *slapt_parse_packages_txt(FILE *);
*/
/*
return a list of available packages must be already chdir'd to
rc_config->working_dir. Otherwise, open a filehandle to the package data
and pass it to slapt_parse_packages_txt();
- struct slapt_pkg_list *slapt_get_available_pkgs(void);
+ slapt_pkg_list_t *slapt_get_available_pkgs(void);
*/
/* get a list of obsolete packages
- struct slapt_pkg_list *
+ slapt_pkg_list_t *
slapt_get_obsolete_pkgs ( const slapt_rc_config *global_config,
- struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs);
+ slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs);
*/
/*
fill in the md5sum of the package
- void slapt_get_md5sums(struct slapt_pkg_list *pkgs, FILE *checksum_file);
+ void slapt_get_md5sums(slapt_pkg_list_t *pkgs, FILE *checksum_file);
*/
}
@@ -133,8 +133,8 @@ END_TEST
START_TEST (test_pkg_search)
{
slapt_pkg_info_t *p = NULL;
- struct slapt_pkg_list *l = NULL;
- struct slapt_pkg_list *list = slapt_init_pkg_list();
+ slapt_pkg_list_t *l = NULL;
+ slapt_pkg_list_t *list = slapt_init_pkg_list();
slapt_add_pkg_to_pkg_list(list, &pkg);
p = slapt_get_newest_pkg(list, "gslapt");
@@ -300,25 +300,25 @@ START_TEST (test_dependency)
returns 0 on success, -1 on error setting conflict_err and missing_err
(usually called with transaction->conflict_err and transaction->missing_err)
int slapt_get_pkg_dependencies(const slapt_rc_config *global_config,
- struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs,
+ slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs,
slapt_pkg_info_t *pkg,
- struct slapt_pkg_list *deps,
- struct slapt_pkg_err_list *conflict_err,
- struct slapt_pkg_err_list *missing_err);
+ slapt_pkg_list_t *deps,
+ slapt_pkg_err_list_t *conflict_err,
+ slapt_pkg_err_list_t *missing_err);
*/
/*
return list of package conflicts
- struct slapt_pkg_list *slapt_get_pkg_conflicts(struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs,
+ slapt_pkg_list_t *slapt_get_pkg_conflicts(slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs,
slapt_pkg_info_t *pkg);
*/
/*
return list of packages required by
- struct slapt_pkg_list *slapt_is_required_by(const slapt_rc_config *global_config,
- struct slapt_pkg_list *avail,
+ slapt_pkg_list_t *slapt_is_required_by(const slapt_rc_config *global_config,
+ slapt_pkg_list_t *avail,
slapt_pkg_info_t *pkg);
*/
}
@@ -332,7 +332,7 @@ START_TEST (test_cache)
slapt_clean_pkg_dir(rc->working_dir);
/* not easily testable due to timeout
- struct slapt_pkg_list *list = slapt_init_pkg_list();
+ slapt_pkg_list_t *list = slapt_init_pkg_list();
slapt_purge_old_cached_pkgs(rc, NULL, list);
*/
@@ -343,7 +343,7 @@ END_TEST
START_TEST (test_error)
{
- struct slapt_pkg_err_list *list = slapt_init_pkg_err_list();
+ slapt_pkg_err_list_t *list = slapt_init_pkg_err_list();
slapt_add_pkg_err_to_list(list, "gslapt", "Server returned 404");
@@ -365,13 +365,13 @@ START_TEST (test_network)
/* write pkg data to disk
void slapt_write_pkg_data(const char *source_url,FILE *d_file,
- struct slapt_pkg_list *pkgs);
+ slapt_pkg_list_t *pkgs);
*/
/* download the PACKAGES.TXT and CHECKSUMS.md5 files
- struct slapt_pkg_list *slapt_get_pkg_source_packages (const slapt_rc_config *global_config,
+ slapt_pkg_list_t *slapt_get_pkg_source_packages (const slapt_rc_config *global_config,
const char *url);
- struct slapt_pkg_list *slapt_get_pkg_source_patches (const slapt_rc_config *global_config,
+ slapt_pkg_list_t *slapt_get_pkg_source_patches (const slapt_rc_config *global_config,
const char *url);
FILE *slapt_get_pkg_source_checksums (const slapt_rc_config *global_config,
const char *url);