aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo@golang.org>2020-08-17 18:12:19 -0400
committerFilippo Valsorda <filippo@golang.org>2020-08-17 18:12:19 -0400
commita15df605fc4aa6347494fd55a5c4c6544b0eb981 (patch)
tree978711ebd88092dbdc5c4b34d9f13b15f49580fa /misc
parent6e6e0b73d6e19872946e08b65c7cac3b0289e2f0 (diff)
parent0fdc3801bfd43d6f55e4ea5bf095e1ea55430339 (diff)
downloadgo-a15df605fc4aa6347494fd55a5c4c6544b0eb981.tar.gz
go-a15df605fc4aa6347494fd55a5c4c6544b0eb981.zip
[dev.boringcrypto.go1.15] all: merge go1.15 into dev.boringcrypto.go1.15
Change-Id: I6eecfb4730f88ea8546ec88afdffe33f45dedac9
Diffstat (limited to 'misc')
-rw-r--r--misc/cgo/test/test.go13
-rw-r--r--misc/cgo/testshared/shared_test.go13
2 files changed, 26 insertions, 0 deletions
diff --git a/misc/cgo/test/test.go b/misc/cgo/test/test.go
index 8c69ad91ac7..35bc3a14475 100644
--- a/misc/cgo/test/test.go
+++ b/misc/cgo/test/test.go
@@ -901,6 +901,12 @@ typedef struct S32579 { unsigned char data[1]; } S32579;
// issue 38649
// Test that #define'd type aliases work.
#define netbsd_gid unsigned int
+
+// issue 40494
+// Inconsistent handling of tagged enum and union types.
+enum Enum40494 { X_40494 };
+union Union40494 { int x; };
+void issue40494(enum Enum40494 e, union Union40494* up) {}
*/
import "C"
@@ -2204,3 +2210,10 @@ var issue38649 C.netbsd_gid = 42
// issue 39877
var issue39877 *C.void = nil
+
+// issue 40494
+// No runtime test; just make sure it compiles.
+
+func Issue40494() {
+ C.issue40494(C.enum_Enum40494(C.X_40494), (*C.union_Union40494)(nil))
+}
diff --git a/misc/cgo/testshared/shared_test.go b/misc/cgo/testshared/shared_test.go
index f8dabbe7a01..5e0893784b6 100644
--- a/misc/cgo/testshared/shared_test.go
+++ b/misc/cgo/testshared/shared_test.go
@@ -462,6 +462,7 @@ func TestTrivialExecutable(t *testing.T) {
run(t, "trivial executable", "../../bin/trivial")
AssertIsLinkedTo(t, "../../bin/trivial", soname)
AssertHasRPath(t, "../../bin/trivial", gorootInstallDir)
+ checkSize(t, "../../bin/trivial", 100000) // it is 19K on linux/amd64, 100K should be enough
}
// Build a trivial program in PIE mode that links against the shared runtime and check it runs.
@@ -470,6 +471,18 @@ func TestTrivialExecutablePIE(t *testing.T) {
run(t, "trivial executable", "./trivial.pie")
AssertIsLinkedTo(t, "./trivial.pie", soname)
AssertHasRPath(t, "./trivial.pie", gorootInstallDir)
+ checkSize(t, "./trivial.pie", 100000) // it is 19K on linux/amd64, 100K should be enough
+}
+
+// Check that the file size does not exceed a limit.
+func checkSize(t *testing.T, f string, limit int64) {
+ fi, err := os.Stat(f)
+ if err != nil {
+ t.Fatalf("stat failed: %v", err)
+ }
+ if sz := fi.Size(); sz > limit {
+ t.Errorf("file too large: got %d, want <= %d", sz, limit)
+ }
}
// Build a division test program and check it runs.