diff options
author | Spandan Das <spandandas@google.com> | 2023-06-14 23:24:22 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-06-14 23:24:22 +0000 |
commit | de80525bbabc1267e61286f2d4dccc553c7063e9 (patch) | |
tree | d9fac15bb5a835ae6ba757dc5eaf6ef597ea44cf /tests/core/cgo/README.rst | |
parent | 9803cf8403d7105bddc1d5304d6e694b781a6605 (diff) | |
parent | 6cf433ad1b548a8bd2d8fddce696af5e29cf950f (diff) | |
download | bazelbuild-rules_go-de80525bbabc1267e61286f2d4dccc553c7063e9.tar.gz |
Merge remote-tracking branch 'aosp/upstream-master' into merge_rules_go am: 49dcd02124 am: 711a453236 am: 6cf433ad1b
Original change: https://android-review.googlesource.com/c/platform/external/bazelbuild-rules_go/+/2625353
Change-Id: Idebe5ece264c411614cce92bcce1993eaff330b2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'tests/core/cgo/README.rst')
-rw-r--r-- | tests/core/cgo/README.rst | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/core/cgo/README.rst b/tests/core/cgo/README.rst new file mode 100644 index 00000000..a385cab3 --- /dev/null +++ b/tests/core/cgo/README.rst @@ -0,0 +1,67 @@ +.. _#2067: https://github.com/bazelbuild/rules_go/issues/2067 +.. _#2622: https://github.com/bazelbuild/rules_go/issues/2622 + +Basic cgo functionality +======================= + +opts_test +--------- + +Checks that different sets of options are passed to C and C++ sources in a +``go_library`` with ``cgo = True``. + +(generated_)?(versioned_)?dylib_test +------------------------------------ + +Checks that Go binaries can link against dynamic C libraries. Some libraries +(especially those provided with ``cc_import``) may only have dynamic versions, +and we should be able to link against them and find them at run-time. + +The non ``generated_`` tests are manual. The ``generate_imported_dylib.sh`` +script must be run before running the tests themselves. + +The ``generated_`` variants check that Go binaries can link against dynamic C +libraries that are generated by another rule, rather than being included in the +source tree. + +The ``versioned_`` variants check that Go binaries can link against dynamic C +libraries that are only available as a versioned shared library, like +``libfoo.so.1``, as used on Linux. + +cc_libs_test +------------ + +Checks that Go binaries that include cgo code may or may not link against +libstdc++, depending on how they're linked. This tests several binaries: + +* ``pure_bin`` - built in ``"pure"`` mode, should not depend on libstdc++. +* ``c_srcs`` - has no C++ code in sources, should not depend on libstdc++. +* ``cc_srcs`` - has some C++ code in sources, should depend on libstdc++. +* ``cc_deps`` - depends on a ``cc_library``, should depend on libstdc++ + because we don't know what's in it. + +race_test +--------- + +Checks that cgo code in a binary with ``race = "on"`` is compiled in race mode. +Verifies #1592. + +tag_test +-------- + +Checks that sources with ``// +build cgo`` are built when cgo is enabled +(whether or not ``cgo = True`` is set), and sources with ``// +build !cgo`` +are only built in pure mode. + +cdeps_link_test +--------------- + +Checks that libraries in ``cdeps`` are linked into the generated ``_cgo_.o`` +executable used to produce ``_cgo_imports.go``. Verifies `#2067`_. + +split_import_test +----------------- + +Checks that when a package with ``cdeps`` is recompiled due to a split test, +the input files from ``cdeps`` are included in the recompilation and are passed +to the linker. Verifies `#2622`_. |