adding test for globbing nonexistent files.
This commit is contained in:
parent
399a99753d
commit
e903731718
@ -3,6 +3,6 @@ TOPDIR = ../../../..
|
|||||||
|
|
||||||
TESTSSUBDIR = xbps/libxbps/config
|
TESTSSUBDIR = xbps/libxbps/config
|
||||||
TEST = config_test
|
TEST = config_test
|
||||||
EXTRA_FILES = Kyuafile xbps.conf 1.include.conf 2.include.conf
|
EXTRA_FILES = Kyuafile xbps.conf xbps_nomatch.conf 1.include.conf 2.include.conf
|
||||||
|
|
||||||
include $(TOPDIR)/mk/test.mk
|
include $(TOPDIR)/mk/test.mk
|
||||||
|
@ -56,9 +56,41 @@ ATF_TC_BODY(config_include_test, tc)
|
|||||||
ATF_REQUIRE_EQ(xbps_array_count(xh.repositories), 2);
|
ATF_REQUIRE_EQ(xbps_array_count(xh.repositories), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ATF_TC(config_include_nomatch_test);
|
||||||
|
ATF_TC_HEAD(config_include_nomatch_test, tc)
|
||||||
|
{
|
||||||
|
atf_tc_set_md_var(tc, "descr", "Test finds no files to include");
|
||||||
|
}
|
||||||
|
|
||||||
|
ATF_TC_BODY(config_include_nomatch_test, tc)
|
||||||
|
{
|
||||||
|
struct xbps_handle xh;
|
||||||
|
const char *tcsdir;
|
||||||
|
char conffile[XBPS_MAXPATH-1];
|
||||||
|
|
||||||
|
/* get test source dir */
|
||||||
|
tcsdir = atf_tc_get_config_var(tc, "srcdir");
|
||||||
|
|
||||||
|
/* change dir to make sure relative paths won't match */
|
||||||
|
ATF_REQUIRE_EQ(chdir("/"), 0);
|
||||||
|
memset(&xh, 0, sizeof(xh));
|
||||||
|
strncpy(xh.rootdir, tcsdir, sizeof(xh.rootdir));
|
||||||
|
strncpy(xh.metadir, tcsdir, sizeof(xh.metadir));
|
||||||
|
strncpy(conffile, tcsdir, sizeof(conffile));
|
||||||
|
strncat(conffile, "/xbps_nomatch.conf", sizeof(conffile)-1);
|
||||||
|
xh.conffile = conffile;
|
||||||
|
xh.flags = XBPS_FLAG_DEBUG;
|
||||||
|
ATF_REQUIRE_EQ(xbps_init(&xh), 0);
|
||||||
|
|
||||||
|
/* should contain no repositories */
|
||||||
|
ATF_REQUIRE_EQ(xbps_array_count(xh.repositories), 0);
|
||||||
|
}
|
||||||
|
|
||||||
ATF_TP_ADD_TCS(tp)
|
ATF_TP_ADD_TCS(tp)
|
||||||
{
|
{
|
||||||
ATF_TP_ADD_TC(tp, config_include_test);
|
ATF_TP_ADD_TC(tp, config_include_test);
|
||||||
|
ATF_TP_ADD_TC(tp, config_include_nomatch_test);
|
||||||
|
|
||||||
return atf_no_error();
|
return atf_no_error();
|
||||||
}
|
}
|
||||||
|
3
tests/xbps/libxbps/config/xbps_nomatch.conf
Normal file
3
tests/xbps/libxbps/config/xbps_nomatch.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# relative path
|
||||||
|
include=*.this_file_does_not_exist.conf
|
||||||
|
include=nodir/*.this_file_does_not_exist.conf
|
Loading…
Reference in New Issue
Block a user