]> Cypherpunks.ru repositories - gostls13.git/commit
misc/swig: restructure as a driver
authorAustin Clements <austin@google.com>
Mon, 8 May 2023 18:39:57 +0000 (14:39 -0400)
committerAustin Clements <austin@google.com>
Fri, 12 May 2023 12:00:05 +0000 (12:00 +0000)
commit2484e1331a6054ffa25e2e6a4146943251171c56
tree13d8ab09c60f5c51d659f7651fedaf4820ede7be
parent711609d55f7d1254e0400fd870c97d5c5a259a99
misc/swig: restructure as a driver

Currently, the misc/swig tests directly use Swig and C++ and will fail
to build if either Swig or a C++ compiler are not present. Typically,
we hide this fact from users because dist test itself checks for Swig
and a C++ compiler before even attempting to run this test, though
users will see this is they try to go test ./... from misc.

However, we're about to move the misc/swig tests into the cmd module,
where they will be much more visible and much more likely to run
unintentionally. To prevent build errors, this CL restructures these
tests into a single pure Go test plus two test packages hidden in
testdata. This is relatively easy to do for this test because there
are only four test cases total. The pure Go test can check for the
necessary build tools before trying to build and run the tests in
testdata. This also gives us the opportunity to move the LTO variant
of these tests out of dist and into the test itself, simplifying dist.

For #37486.

Change-Id: Ibda089b4069e36866cb31867a7006c790be2d8b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/493599
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 files changed:
misc/swig/callback/callback.go [deleted file]
misc/swig/callback/callback_test.go [deleted file]
misc/swig/nocgo_test.go [new file with mode: 0644]
misc/swig/stdio/file.go [deleted file]
misc/swig/stdio/file_test.go [deleted file]
misc/swig/swig_test.go [new file with mode: 0644]
misc/swig/testdata/callback/main.cc [moved from misc/swig/callback/callback.cc with 94% similarity]
misc/swig/testdata/callback/main.go [new file with mode: 0644]
misc/swig/testdata/callback/main.h [moved from misc/swig/callback/callback.h with 100% similarity]
misc/swig/testdata/callback/main.swigcxx [moved from misc/swig/callback/callback.swigcxx with 88% similarity]
misc/swig/testdata/stdio/main.go [new file with mode: 0644]
misc/swig/testdata/stdio/main.swig [moved from misc/swig/stdio/file.swig with 100% similarity]
src/cmd/dist/test.go