You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2015/10/06 02:08:50 UTC
[1/3] lucy git commit: Run core tests from Go bindings.
Repository: lucy
Updated Branches:
refs/heads/master 4f37426bf -> a347c8170
Run core tests from Go bindings.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/9eebf50f
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/9eebf50f
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/9eebf50f
Branch: refs/heads/master
Commit: 9eebf50f91f4e0420af15cbb3947208f992500c3
Parents: 874d4a3
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Wed Sep 30 12:50:58 2015 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Wed Sep 30 19:13:30 2015 -0700
----------------------------------------------------------------------
go/lucy/lucy.go | 2 ++
go/lucy/test.go | 30 ++++++++++++++++++++++++++++++
go/lucy/test_test.go | 30 ++++++++++++++++++++++++++++++
3 files changed, 62 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/9eebf50f/go/lucy/lucy.go
----------------------------------------------------------------------
diff --git a/go/lucy/lucy.go b/go/lucy/lucy.go
index 595f777..42dc119 100644
--- a/go/lucy/lucy.go
+++ b/go/lucy/lucy.go
@@ -28,6 +28,7 @@ package lucy
#define C_LUCY_POLYDOCREADER
#include "lucy_parcel.h"
+#include "testlucy_parcel.h"
#include "Lucy/Analysis/RegexTokenizer.h"
#include "Lucy/Document/Doc.h"
#include "Lucy/Index/DocReader.h"
@@ -196,6 +197,7 @@ var registry *objRegistry
func init() {
C.GOLUCY_glue_exported_symbols()
C.lucy_bootstrap_parcel()
+ C.testlucy_bootstrap_parcel()
registry = newObjRegistry(16)
initWRAP()
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/9eebf50f/go/lucy/test.go
----------------------------------------------------------------------
diff --git a/go/lucy/test.go b/go/lucy/test.go
new file mode 100644
index 0000000..64e926b
--- /dev/null
+++ b/go/lucy/test.go
@@ -0,0 +1,30 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package lucy
+
+/*
+#include "Lucy/Test.h"
+*/
+import "C"
+import "unsafe"
+
+import "git-wip-us.apache.org/repos/asf/lucy-clownfish.git/runtime/go/clownfish"
+
+func createTestSuite() clownfish.TestSuite {
+ ts := C.testlucy_Test_create_test_suite()
+ return clownfish.WRAPAny(unsafe.Pointer(ts)).(clownfish.TestSuite)
+}
http://git-wip-us.apache.org/repos/asf/lucy/blob/9eebf50f/go/lucy/test_test.go
----------------------------------------------------------------------
diff --git a/go/lucy/test_test.go b/go/lucy/test_test.go
new file mode 100644
index 0000000..3c42fd3
--- /dev/null
+++ b/go/lucy/test_test.go
@@ -0,0 +1,30 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package lucy
+
+import "testing"
+
+import "git-wip-us.apache.org/repos/asf/lucy-clownfish.git/runtime/go/clownfish"
+
+func TestRunCoreTests(t *testing.T) {
+ suite := createTestSuite()
+ formatter := clownfish.NewTestFormatterCF()
+ success := suite.RunAllBatches(formatter)
+ if !success {
+ t.Error("Core tests failed")
+ }
+}
[3/3] lucy git commit: Merge branch 'LUCY-285-core-tests-under-go'
Posted by ma...@apache.org.
Merge branch 'LUCY-285-core-tests-under-go'
Run the core tests under the Go bindings, just as we do under other
host bindings.
Skip Analysis tests when the test data can't be found.
This closes #22.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/a347c817
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/a347c817
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/a347c817
Branch: refs/heads/master
Commit: a347c8170ef6d5a2004745aec82eaac42ecf0652
Parents: 4f37426 9eebf50
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Oct 5 16:17:11 2015 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Mon Oct 5 16:17:11 2015 -0700
----------------------------------------------------------------------
core/Lucy/Test/Analysis/TestNormalizer.c | 5 +++
core/Lucy/Test/Analysis/TestSnowballStemmer.c | 5 +++
core/Lucy/Test/Analysis/TestStandardTokenizer.c | 33 +++++++++++---------
core/Lucy/Test/TestUtils.c | 3 +-
core/Lucy/Test/TestUtils.cfh | 4 ++-
go/lucy/lucy.go | 2 ++
go/lucy/test.go | 30 ++++++++++++++++++
go/lucy/test_test.go | 30 ++++++++++++++++++
8 files changed, 95 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
[2/3] lucy git commit: Skip Analysis tests when test data not found.
Posted by ma...@apache.org.
Skip Analysis tests when test data not found.
Rather than fail when the JSON files containing test data cannot be
found, skip the tests.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/874d4a38
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/874d4a38
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/874d4a38
Branch: refs/heads/master
Commit: 874d4a38077286f1e41391d257051f641b0ecb7c
Parents: 4f37426
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Wed Sep 30 12:02:15 2015 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Wed Sep 30 19:13:30 2015 -0700
----------------------------------------------------------------------
core/Lucy/Test/Analysis/TestNormalizer.c | 5 +++
core/Lucy/Test/Analysis/TestSnowballStemmer.c | 5 +++
core/Lucy/Test/Analysis/TestStandardTokenizer.c | 33 +++++++++++---------
core/Lucy/Test/TestUtils.c | 3 +-
core/Lucy/Test/TestUtils.cfh | 4 ++-
5 files changed, 33 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/874d4a38/core/Lucy/Test/Analysis/TestNormalizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestNormalizer.c b/core/Lucy/Test/Analysis/TestNormalizer.c
index 3c0c618..ab68930 100644
--- a/core/Lucy/Test/Analysis/TestNormalizer.c
+++ b/core/Lucy/Test/Analysis/TestNormalizer.c
@@ -74,6 +74,11 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
static void
test_normalization(TestBatchRunner *runner) {
FSFolder *modules_folder = TestUtils_modules_folder();
+ if (modules_folder == NULL) {
+ SKIP(runner, 13, "Can't locate test data");
+ return;
+ }
+
String *path = Str_newf("unicode/utf8proc/tests.json");
Vector *tests = (Vector*)Json_slurp_json((Folder*)modules_folder, path);
if (!tests) { RETHROW(Err_get_error()); }
http://git-wip-us.apache.org/repos/asf/lucy/blob/874d4a38/core/Lucy/Test/Analysis/TestSnowballStemmer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestSnowballStemmer.c b/core/Lucy/Test/Analysis/TestSnowballStemmer.c
index 87b88c9..1a066ab 100644
--- a/core/Lucy/Test/Analysis/TestSnowballStemmer.c
+++ b/core/Lucy/Test/Analysis/TestSnowballStemmer.c
@@ -64,6 +64,11 @@ test_Dump_Load_and_Equals(TestBatchRunner *runner) {
static void
test_stemming(TestBatchRunner *runner) {
FSFolder *modules_folder = TestUtils_modules_folder();
+ if (modules_folder == NULL) {
+ SKIP(runner, 150, "Can't locate test data");
+ return;
+ }
+
String *path = Str_newf("analysis/snowstem/source/test/tests.json");
Hash *tests = (Hash*)Json_slurp_json((Folder*)modules_folder, path);
if (!tests) { RETHROW(Err_get_error()); }
http://git-wip-us.apache.org/repos/asf/lucy/blob/874d4a38/core/Lucy/Test/Analysis/TestStandardTokenizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestStandardTokenizer.c b/core/Lucy/Test/Analysis/TestStandardTokenizer.c
index 2676549..5ada7ec 100644
--- a/core/Lucy/Test/Analysis/TestStandardTokenizer.c
+++ b/core/Lucy/Test/Analysis/TestStandardTokenizer.c
@@ -95,22 +95,27 @@ test_tokenizer(TestBatchRunner *runner) {
DECREF(got);
FSFolder *modules_folder = TestUtils_modules_folder();
- String *path = Str_newf("unicode/ucd/WordBreakTest.json");
- Vector *tests = (Vector*)Json_slurp_json((Folder*)modules_folder, path);
- if (!tests) { RETHROW(Err_get_error()); }
-
- for (uint32_t i = 0, max = Vec_Get_Size(tests); i < max; i++) {
- Hash *test = (Hash*)Vec_Fetch(tests, i);
- String *text = (String*)Hash_Fetch_Utf8(test, "text", 4);
- Vector *wanted = (Vector*)Hash_Fetch_Utf8(test, "words", 5);
- Vector *got = StandardTokenizer_Split(tokenizer, text);
- TEST_TRUE(runner, Vec_Equals(wanted, (Obj*)got), "UCD test #%d", i + 1);
- DECREF(got);
+ if (modules_folder == NULL) {
+ SKIP(runner, 1372, "Can't locate test data");
}
+ else {
+ String *path = Str_newf("unicode/ucd/WordBreakTest.json");
+ Vector *tests = (Vector*)Json_slurp_json((Folder*)modules_folder, path);
+ if (!tests) { RETHROW(Err_get_error()); }
+
+ for (uint32_t i = 0, max = Vec_Get_Size(tests); i < max; i++) {
+ Hash *test = (Hash*)Vec_Fetch(tests, i);
+ String *text = (String*)Hash_Fetch_Utf8(test, "text", 4);
+ Vector *wanted = (Vector*)Hash_Fetch_Utf8(test, "words", 5);
+ Vector *got = StandardTokenizer_Split(tokenizer, text);
+ TEST_TRUE(runner, Vec_Equals(wanted, (Obj*)got), "UCD test #%d", i + 1);
+ DECREF(got);
+ }
- DECREF(tests);
- DECREF(modules_folder);
- DECREF(path);
+ DECREF(tests);
+ DECREF(modules_folder);
+ DECREF(path);
+ }
DECREF(tokenizer);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/874d4a38/core/Lucy/Test/TestUtils.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/TestUtils.c b/core/Lucy/Test/TestUtils.c
index 4534a28..68171dc 100644
--- a/core/Lucy/Test/TestUtils.c
+++ b/core/Lucy/Test/TestUtils.c
@@ -180,7 +180,6 @@ TestUtils_modules_folder() {
DECREF(modules_folder);
}
- THROW(ERR, "Can't open modules folder");
- UNREACHABLE_RETURN(FSFolder*);
+ return NULL;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/874d4a38/core/Lucy/Test/TestUtils.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/TestUtils.cfh b/core/Lucy/Test/TestUtils.cfh
index 5960283..0d3e15c 100644
--- a/core/Lucy/Test/TestUtils.cfh
+++ b/core/Lucy/Test/TestUtils.cfh
@@ -66,8 +66,10 @@ inert class Lucy::Test::TestUtils {
Vector *expected, const char *message);
/** Return the "modules" folder.
+ *
+ * If the folder cannot be found, return NULL.
*/
- inert FSFolder*
+ inert incremented nullable FSFolder*
modules_folder();
}