From: Keith Randall Date: Sun, 15 Jul 2018 00:18:45 +0000 (-0700) Subject: [release-branch.go1.10] misc/cgo: fix test on iOS X-Git-Tag: go1.10.4~11 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1dea6c5269e67ab7c8201988cf6e15f914f1a8f7;p=gostls13.git [release-branch.go1.10] misc/cgo: fix test on iOS The test in CL 123715 doesn't work on iOS, it needs to use a different version scheme to determine whether SecKeyAlgorithm and friends exist. Restrict the old version test to OSX only. The same problem occurs on iOS: the functions tested don't exist before iOS 10. But we don't have builders below iOS 10, so it isn't a big issue. If we ever get older builders, or someone wants to run all.bash on an old iOS, they'll need to figure out the right incantation. Update #25036 Change-Id: Ia3ace86b00486dc172ed00c0c6d668a95565bff7 Reviewed-on: https://go-review.googlesource.com/123959 Run-TryBot: Keith Randall TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick Reviewed-on: https://go-review.googlesource.com/124217 Reviewed-by: Ian Lance Taylor --- diff --git a/misc/cgo/test/issue24161e0/main.go b/misc/cgo/test/issue24161e0/main.go index 4e2e4b01d3..72985b6c77 100644 --- a/misc/cgo/test/issue24161e0/main.go +++ b/misc/cgo/test/issue24161e0/main.go @@ -9,9 +9,10 @@ package issue24161e0 /* #cgo CFLAGS: -x objective-c #cgo LDFLAGS: -framework CoreFoundation -framework Security +#include #include #include -#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200 +#if TARGET_OS_OSX && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200 typedef CFStringRef SecKeyAlgorithm; static CFDataRef SecKeyCreateSignature(SecKeyRef key, SecKeyAlgorithm algorithm, CFDataRef dataToSign, CFErrorRef *error){return NULL;} #define kSecKeyAlgorithmECDSASignatureDigestX962SHA1 foo() diff --git a/misc/cgo/test/issue24161e1/main.go b/misc/cgo/test/issue24161e1/main.go index 3e2aba2742..8a31e22397 100644 --- a/misc/cgo/test/issue24161e1/main.go +++ b/misc/cgo/test/issue24161e1/main.go @@ -9,9 +9,10 @@ package issue24161e1 /* #cgo CFLAGS: -x objective-c #cgo LDFLAGS: -framework CoreFoundation -framework Security +#include #include #include -#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200 +#if TARGET_OS_OSX && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200 typedef CFStringRef SecKeyAlgorithm; static CFDataRef SecKeyCreateSignature(SecKeyRef key, SecKeyAlgorithm algorithm, CFDataRef dataToSign, CFErrorRef *error){return NULL;} #define kSecKeyAlgorithmECDSASignatureDigestX962SHA1 foo() diff --git a/misc/cgo/test/issue24161e2/main.go b/misc/cgo/test/issue24161e2/main.go index 9e4053eba5..f4e0def8c0 100644 --- a/misc/cgo/test/issue24161e2/main.go +++ b/misc/cgo/test/issue24161e2/main.go @@ -9,9 +9,10 @@ package issue24161e2 /* #cgo CFLAGS: -x objective-c #cgo LDFLAGS: -framework CoreFoundation -framework Security +#include #include #include -#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200 +#if TARGET_OS_OSX && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200 typedef CFStringRef SecKeyAlgorithm; static CFDataRef SecKeyCreateSignature(SecKeyRef key, SecKeyAlgorithm algorithm, CFDataRef dataToSign, CFErrorRef *error){return NULL;} #define kSecKeyAlgorithmECDSASignatureDigestX962SHA1 foo()