summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2017-02-08 22:24:36 +0000
committerGitHub <noreply@github.com>2017-02-08 22:24:36 +0000
commit7c0ec265a89808893a692f6205f2555f30198444 (patch)
tree5f614d77d97356f9b946dec90bace4953ab03c92
parente92045d3c46eaaa41ec4ed237a0887d097734ae0 (diff)
parent730e6bf5a0eea0b00565f0f8875c4a0618f4c675 (diff)
downloadenchant-tags/enchant-1-6-1.tar.gz
Merge pull request #74 from rrthomas/masterenchant-1-6-1
Fix tests on Windows and add Windows CI via Appveyor
-rw-r--r--appveyor.yml20
-rwxr-xr-xbuild-aux/appveyor-install.sh12
-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
11 files changed, 71 insertions, 22 deletions
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..c0af82b
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,20 @@
+version: "{build}"
+
+environment:
+ global:
+ CONFIGURE_FLAGS: --with-myspell-dir=/mingw64/share/hunspell
+ VERBOSE: 1 # Get test logs in output
+
+# FIXME: Build on mingw-w64, mingw-w32 and MSYS2
+# matrix:
+# - COMPILER: MinGW-w64
+# - COMPILER: MinGW-w32
+
+init:
+ - git config --global core.autocrlf input
+
+install:
+ - C:\msys64\usr\bin\bash.exe -l c:/projects/enchant/build-aux/appveyor-install.sh
+
+build_script:
+ - C:\msys64\usr\bin\bash.exe -lc "cd c:/projects/enchant && ./autogen.sh %CONFIGURE_FLAGS% && make && make DISTCHECK_CONFIGURE_FLAGS=%CONFIGURE_FLAGS% distcheck"
diff --git a/build-aux/appveyor-install.sh b/build-aux/appveyor-install.sh
new file mode 100755
index 0000000..e24836a
--- /dev/null
+++ b/build-aux/appveyor-install.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Pre-install script for appveyor
+
+pacman --noconfirm -S glib2-devel
+wget http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-hunspell-en-2016.11.20-2-any.pkg.tar.xz
+pacman --noconfirm -U mingw-w64-x86_64-hunspell-en-2016.11.20-2-any.pkg.tar.xz
+wget https://github.com/hunspell/hunspell/archive/v1.6.0.tar.gz
+tar zxvf v1.6.0.tar.gz || true # Error in unpacking (symlink README before file README.md)
+cd hunspell-1.6.0 && ln -s README.md README && autoreconf -vfi && ./configure --prefix=/usr && make && make install
+wget https://github.com/unittest-cpp/unittest-cpp/releases/download/v1.6.1/unittest-cpp-1.6.1.tar.gz
+tar zxvf unittest-cpp-1.6.1.tar.gz
+cd unittest-cpp-1.6.1 && ./configure --prefix=/usr && make && make install
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();