new file mode 100644
@@ -0,0 +1,15 @@
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.runtime.decorator.package import OEHasPackage
+
+class CgoHelloworldTest(OERuntimeTestCase):
+ @OETestDepends(['ssh.SSHTest.test_ssh'])
+ @OEHasPackage(['cgo-helloworld'])
+ def test_cgohelloworld(self):
+ cmd = "cgo-helloworld"
+ status, output = self.target.run(cmd)
+ msg = 'Exit status was not 0. Output: %s' % output
+ self.assertEqual(status, 0, msg=msg)
+
+ msg = 'Incorrect output: %s' % output
+ self.assertEqual(output, "Hello, world!", msg=msg)
new file mode 100644
@@ -0,0 +1,4 @@
+GOTOOLS = "\
+ go-helloworld \
+ cgo-helloworld \
+ "
new file mode 100644
@@ -0,0 +1,9 @@
+package main
+
+// #include <stdio.h>
+// void hello() { printf("Hello, world!\n"); fflush(stdout);}
+import "C"
+
+func main() {
+ C.hello()
+}
new file mode 100644
@@ -0,0 +1,23 @@
+SUMMARY = "A simple CGO example that calls C to print hello world"
+SECTION = "examples"
+HOMEPAGE = "https://golang.org/"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+SRC_URI = "file://cgo-helloworld.go"
+
+S = "${UNPACKDIR}"
+
+GO_IMPORT = "cgo-helloworld"
+GO_INSTALL = "${GO_IMPORT}"
+
+inherit go
+
+export GO111MODULE = "off"
+export CGO_ENABLED = "1"
+
+do_configure:prepend() {
+ mkdir -p ${S}/src/${GO_IMPORT}
+ cp ${UNPACKDIR}/cgo-helloworld.go ${S}/src/${GO_IMPORT}/main.go
+}
new file mode 100644
@@ -0,0 +1,2 @@
+# UNPACKDIR does not exist yet in scarthgap
+UNPACKDIR = "${WORKDIR}"