summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2017-02-07 16:58:25 +0000
committerReuben Thomas <rrt@sc3d.org>2017-02-07 16:58:25 +0000
commit647a6300757e141a53a7e7ceb207f6211cb55009 (patch)
tree5e7123def783ded72df0d449e3f43343f76ba6e7
parente92045d3c46eaaa41ec4ed237a0887d097734ae0 (diff)
downloadenchant-647a6300757e141a53a7e7ceb207f6211cb55009.tar.gz
Fix tests on Windows (specifically, tested on MSYS2)
-rw-r--r--tests/.gitignore4
-rw-r--r--unittests/.gitignore2
-rw-r--r--unittests/EnchantBrokerTestFixture.h30
-rw-r--r--unittests/EnchantDictionaryTestFixture.h6
-rw-r--r--unittests/Makefile.am4
-rw-r--r--unittests/enchant_providers/.gitignore1
-rw-r--r--unittests/enchant_providers/Makefile.am6
-rw-r--r--unittests/mock_provider/mock_provider.cpp2
-rw-r--r--unittests/pwl/enchant_pwl_tests.cpp6
9 files changed, 39 insertions, 22 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index c19e2a7..b6b3a4d 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,6 +1,10 @@
/enchant
+/enchant.exe
/enchant-lsmod
+/enchant-lsmod.exe
/ispell
/enchant.test
+/enchant.test.exe
/enchantxx.test
+/enchantxx.test.exe
/test.pwl
diff --git a/unittests/.gitignore b/unittests/.gitignore
index 6497ea3..9a151be 100644
--- a/unittests/.gitignore
+++ b/unittests/.gitignore
@@ -1,2 +1,4 @@
/main
+/main.exe
libenchant_*.so
+*enchant*.dll
diff --git a/unittests/EnchantBrokerTestFixture.h b/unittests/EnchantBrokerTestFixture.h
index 209b76d..01b176e 100644
--- a/unittests/EnchantBrokerTestFixture.h
+++ b/unittests/EnchantBrokerTestFixture.h
@@ -125,8 +125,8 @@ struct EnchantBrokerTestFixture : EnchantTestFixture
userMockProviderConfiguration = userConfiguration;
userMockProvider2Configuration = user2Configuration;
- CopyProvider("libenchant_mock_provider", "libenchant_mock_provider");
- hModule = g_module_open("lib/enchant/libenchant_mock_provider", (GModuleFlags) 0);
+ CopyProvider("enchant_mock_provider", "enchant_mock_provider");
+ hModule = g_module_open("lib/enchant/enchant_mock_provider", (GModuleFlags) 0);
if(hModule!=NULL){
SET_CONFIGURE sc;
assert(g_module_symbol(hModule, "set_configure", (gpointer *)&sc));
@@ -135,8 +135,8 @@ struct EnchantBrokerTestFixture : EnchantTestFixture
hModule2 = NULL;
if(user2Configuration != NULL){
- CopyProvider("libenchant_mock_provider2", "libenchant_mock_provider2");
- hModule2 = g_module_open("lib/enchant/libenchant_mock_provider2", (GModuleFlags) 0);
+ CopyProvider("enchant_mock_provider2", "enchant_mock_provider2");
+ hModule2 = g_module_open("lib/enchant/enchant_mock_provider2", (GModuleFlags) 0);
if(hModule2!=NULL){
SET_CONFIGURE sc;
assert(g_module_symbol(hModule2, "set_configure", (gpointer *)&sc));
@@ -145,10 +145,10 @@ struct EnchantBrokerTestFixture : EnchantTestFixture
}
if(includeNullProviders){
- CopyProvider("libenchant_null_provider", "null_provider");
- CopyProvider("libenchant_null_identify", "null_identify");
- CopyProvider("libenchant_null_describe", "null_describe");
- CopyProvider("libenchant", "libenchant"); //not a provider
+ CopyProvider("enchant_null_provider", "null_provider");
+ CopyProvider("enchant_null_identify", "null_identify");
+ CopyProvider("enchant_null_describe", "null_describe");
+ CopyProvider("enchant", "enchant"); //not a provider
}
#if _WIN32
@@ -183,8 +183,18 @@ struct EnchantBrokerTestFixture : EnchantTestFixture
void CopyProvider(const std::string& sourceProviderName, const std::string& destinationProviderName)
{
- std::string sourceName = sourceProviderName +"."+ G_MODULE_SUFFIX;
- std::string destinationName = destinationProviderName + "." +G_MODULE_SUFFIX;
+ std::string prefix =
+ // FIXME: Get this information from libtool
+#if defined(__MSYS__)
+ "msys-"
+#elif defined(__CYGWIN__)
+ "cyg"
+#else
+ "lib"
+#endif
+ ;
+ std::string sourceName = prefix + sourceProviderName + "." + G_MODULE_SUFFIX;
+ std::string destinationName = destinationProviderName + "." + G_MODULE_SUFFIX;
std::string destinationDir = AddToPath(AddToPath(GetDirectoryOfThisModule(), "lib"),"enchant");
diff --git a/unittests/EnchantDictionaryTestFixture.h b/unittests/EnchantDictionaryTestFixture.h
index aa5109c..e94e222 100644
--- a/unittests/EnchantDictionaryTestFixture.h
+++ b/unittests/EnchantDictionaryTestFixture.h
@@ -265,7 +265,7 @@ struct EnchantDictionaryTestFixture : EnchantBrokerTestFixture
sleep(1); // FAT systems have a 2 second resolution
// NTFS is appreciably faster but no specs on what it is exactly
// c runtime library's time_t has a 1 second resolution
- FILE * f = g_fopen(filename.c_str(), "at");
+ FILE * f = g_fopen(filename.c_str(), "a");
if(f)
{
fputc('\n', f);
@@ -279,7 +279,7 @@ struct EnchantDictionaryTestFixture : EnchantBrokerTestFixture
sleep(1); // FAT systems have a 2 second resolution
// NTFS is appreciably faster but no specs on what it is exactly
// c runtime library's time_t has a 1 second resolution
- FILE * f = g_fopen(GetPersonalDictFileName().c_str(), "at");
+ FILE * f = g_fopen(GetPersonalDictFileName().c_str(), "a");
if(f)
{
fputc('\n', f);
@@ -292,7 +292,7 @@ struct EnchantDictionaryTestFixture : EnchantBrokerTestFixture
sleep(1); // FAT systems have a 2 second resolution
// NTFS is appreciably faster but no specs on what it is exactly
// c runtime library's time_t has a 1 second resolution
- FILE * f = g_fopen(GetPersonalDictFileName().c_str(), "at");
+ FILE * f = g_fopen(GetPersonalDictFileName().c_str(), "a");
if(f)
{
for (std::vector<std::string>::const_iterator itWord = sWords.begin();
diff --git a/unittests/Makefile.am b/unittests/Makefile.am
index 9e352c5..7948641 100644
--- a/unittests/Makefile.am
+++ b/unittests/Makefile.am
@@ -6,7 +6,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(UNITTESTPP_CFLAGS)
AM_TESTS_ENVIRONMENT = \
ENCHANT_MODULE_PATH=$(top_builddir)/unittests/lib/enchant; \
export ENCHANT_MODULE_PATH; \
- cp $(builddir)/mock_provider/*.so $(builddir)/mock_provider/.libs/*.so . || :;
+ cp $(builddir)/mock_provider/*.so $(builddir)/mock_provider/.libs/*.so $(builddir)/mock_provider/*.dll $(builddir)/mock_provider/.libs/*.dll . || :;
DEPS = $(top_builddir)/src/libenchant.la
ldadd = $(top_builddir)/src/libenchant.la $(ENCHANT_LIBS)
@@ -53,4 +53,4 @@ main_LDFLAGS =
main_DEPENDENCIES = $(DEPS)
main_LDADD = $(ldadd) $(UNITTESTPP_LIBS) $(ENCHANT_LIBS)
-DISTCLEANFILES = libenchant_*.so
+DISTCLEANFILES = libenchant_*.so *enchant*.dll
diff --git a/unittests/enchant_providers/.gitignore b/unittests/enchant_providers/.gitignore
index 95811e0..824308f 100644
--- a/unittests/enchant_providers/.gitignore
+++ b/unittests/enchant_providers/.gitignore
@@ -1 +1,2 @@
/main
+/main.exe
diff --git a/unittests/enchant_providers/Makefile.am b/unittests/enchant_providers/Makefile.am
index 3cbf489..acf2076 100644
--- a/unittests/enchant_providers/Makefile.am
+++ b/unittests/enchant_providers/Makefile.am
@@ -2,8 +2,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(UNITTESTPP_CFLAGS)
# FIXME: .so extension will not work on Windows
AM_TESTS_ENVIRONMENT = \
- cp $(builddir)/../mock_provider/*.so $(builddir)/../mock_provider/.libs/*.so . || :; \
- cp $(top_builddir)/src/*/*.so $(top_builddir)/src/*/.libs/*.so . || :;
+ cp $(builddir)/../mock_provider/*.so $(builddir)/../mock_provider/.libs/*.so $(builddir)/../mock_provider/*.dll $(builddir)/../mock_provider/.libs/*.dll . || :;
+ cp $(top_builddir)/src/*/*.so $(top_builddir)/src/*/.libs/*.so cp $(top_builddir)/src/*/*.dll $(top_builddir)/src/*/.libs/*.dll . || :;
DEPS = $(top_builddir)/src/libenchant.la
ldadd = $(top_builddir)/src/libenchant.la $(ENCHANT_LIBS)
@@ -28,4 +28,4 @@ main_LDFLAGS =
main_DEPENDENCIES = $(DEPS)
main_LDADD = $(ldadd) $(UNITTESTPP_LIBS)
-DISTCLEANFILES = libenchant_*.so
+DISTCLEANFILES = libenchant_*.so *enchant*.dll
diff --git a/unittests/mock_provider/mock_provider.cpp b/unittests/mock_provider/mock_provider.cpp
index 3291541..5bed47c 100644
--- a/unittests/mock_provider/mock_provider.cpp
+++ b/unittests/mock_provider/mock_provider.cpp
@@ -101,4 +101,4 @@ configure_enchant_provider(EnchantProvider * me, const char *dir_name)
}
}
-} \ No newline at end of file
+}
diff --git a/unittests/pwl/enchant_pwl_tests.cpp b/unittests/pwl/enchant_pwl_tests.cpp
index 99e6394..90be9e8 100644
--- a/unittests/pwl/enchant_pwl_tests.cpp
+++ b/unittests/pwl/enchant_pwl_tests.cpp
@@ -201,7 +201,7 @@ TEST_FIXTURE(EnchantPwl_TestFixture,
sleep(1); // FAT systems have a 2 second resolution
// NTFS is appreciably faster but no specs on what it is exactly
// c runtime library's time_t has a 1 second resolution
- FILE * f = g_fopen(GetPersonalDictFileName().c_str(), "at");
+ FILE * f = g_fopen(GetPersonalDictFileName().c_str(), "a");
if(f)
{
fputs(Utf8Bom, f);
@@ -257,7 +257,7 @@ TEST_FIXTURE(EnchantPwl_TestFixture,
sleep(1); // FAT systems have a 2 second resolution
// NTFS is appreciably faster but no specs on what it is exactly
// c runtime library's time_t has a 1 second resolution
- FILE * f = g_fopen(GetPersonalDictFileName().c_str(), "at");
+ FILE * f = g_fopen(GetPersonalDictFileName().c_str(), "a");
if(f)
{
fputs(sWords[0].c_str(), f);
@@ -1153,7 +1153,7 @@ TEST_FIXTURE(EnchantPwl_TestFixture,
sleep(1); // FAT systems have a 2 second resolution
// NTFS is appreciably faster but no specs on what it is exactly
// c runtime library's time_t has a 1 second resolution
- FILE * f = g_fopen(GetPersonalDictFileName().c_str(), "at");
+ FILE * f = g_fopen(GetPersonalDictFileName().c_str(), "a");
if(f) {
fputs(Utf8Bom, f);
for(std::vector<std::string>::const_iterator itWord = sWords.begin();