From 1697a39c8167d7ff82c8123bef72d4f457bd6595 Mon Sep 17 00:00:00 2001 From: Marvin Humphrey Date: Wed, 30 Sep 2015 18:44:59 -0700 Subject: [PATCH 1/3] Disable thread support under Go. Err's design relies on thread-local storage, which is not compatible with Go's goroutines. Resolving the Clownfish and Go concurrency models is left as a TODO. --- runtime/go/build.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/go/build.go b/runtime/go/build.go index 951d8465..abc57a81 100644 --- a/runtime/go/build.go +++ b/runtime/go/build.go @@ -111,7 +111,8 @@ func configure() { } if !current(charmonizerEXE, charmonyH) { runCommand("./charmonizer", "--cc=cc", "--enable-c", "--host=go", - "--enable-makefile", "--", "-std=gnu99", "-O2") + "--enable-makefile", "--disable-threads", "--", "-std=gnu99", + "-O2") } } From 276f924e76a7d82420637cb5d5476a7a16283a65 Mon Sep 17 00:00:00 2001 From: Marvin Humphrey Date: Wed, 30 Sep 2015 18:47:02 -0700 Subject: [PATCH 2/3] Stub out some TestUtils funcs under Go. Create stub implementations for some functions that are required for running the core tests. --- runtime/go/ext/testclownfish.c | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 runtime/go/ext/testclownfish.c diff --git a/runtime/go/ext/testclownfish.c b/runtime/go/ext/testclownfish.c new file mode 100644 index 00000000..6c9018d8 --- /dev/null +++ b/runtime/go/ext/testclownfish.c @@ -0,0 +1,35 @@ +/* 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. + */ + +#define CFISH_USE_SHORT_NAMES + +#include "Clownfish/TestHarness/TestUtils.h" + +void* +TestUtils_clone_host_runtime() { + return NULL; +} + +void +TestUtils_set_host_runtime(void *runtime) { + UNUSED_VAR(runtime); +} + +void +TestUtils_destroy_host_runtime(void *runtime) { + UNUSED_VAR(runtime); +} + From fe2d3b63c92dc70cb97ed650b613df089005a46c Mon Sep 17 00:00:00 2001 From: Marvin Humphrey Date: Wed, 30 Sep 2015 18:52:39 -0700 Subject: [PATCH 3/3] Run core tests under Go. --- runtime/go/clownfish/clownfish.go | 4 ++++ runtime/go/clownfish/test.go | 28 ++++++++++++++++++++++++++++ runtime/go/clownfish/test_test.go | 28 ++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 runtime/go/clownfish/test.go create mode 100644 runtime/go/clownfish/test_test.go diff --git a/runtime/go/clownfish/clownfish.go b/runtime/go/clownfish/clownfish.go index 2cb012ff..6b4dc28b 100644 --- a/runtime/go/clownfish/clownfish.go +++ b/runtime/go/clownfish/clownfish.go @@ -22,6 +22,9 @@ package clownfish #include "charmony.h" +#include "cfish_parcel.h" +#include "testcfish_parcel.h" + #include "Clownfish/Obj.h" #include "Clownfish/Err.h" #include "Clownfish/Class.h" @@ -85,6 +88,7 @@ var wrapReg *map[unsafe.Pointer]WrapFunc func init() { C.GoCfish_glue_exported_symbols() C.cfish_bootstrap_parcel() + C.testcfish_bootstrap_parcel() initWRAP() } diff --git a/runtime/go/clownfish/test.go b/runtime/go/clownfish/test.go new file mode 100644 index 00000000..6e0b6fc1 --- /dev/null +++ b/runtime/go/clownfish/test.go @@ -0,0 +1,28 @@ +/* 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 clownfish + +/* +#include "Clownfish/Test.h" +*/ +import "C" +import "unsafe" + +func createTestSuite() TestSuite { + ts := C.testcfish_Test_create_test_suite() + return WRAPAny(unsafe.Pointer(ts)).(TestSuite) +} diff --git a/runtime/go/clownfish/test_test.go b/runtime/go/clownfish/test_test.go new file mode 100644 index 00000000..4c468855 --- /dev/null +++ b/runtime/go/clownfish/test_test.go @@ -0,0 +1,28 @@ +/* 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 clownfish + +import "testing" + +func TestRunCoreTests(t *testing.T) { + suite := createTestSuite() + formatter := NewTestFormatterCF() + success := suite.RunAllBatches(formatter) + if !success { + t.Error("Core tests failed") + } +}