Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(637)

Unified Diff: test/mac/type_envvars/test_check_sdkroot.sh

Issue 82763006: Fix gyptest-type-envvars.py for Xcode 5.0.0 (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Remove debug Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/mac/type_envvars/test_check_sdkroot.sh
diff --git a/test/mac/type_envvars/test_check_sdkroot.sh b/test/mac/type_envvars/test_check_sdkroot.sh
new file mode 100644
index 0000000000000000000000000000000000000000..86f0edb25647e874c96e8dcafa20bd4f400ae5a1
--- /dev/null
+++ b/test/mac/type_envvars/test_check_sdkroot.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+# Copyright (c) 2014 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+set -e
+
+# `xcodebuild -version` output looks like
+# Xcode 4.6.3
+# Build version 4H1503
+# or like
+# Xcode 3.2.6
+# Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0
+# BuildVersion: 10M2518
+# Convert that to '0463'
+function xcodeversion() {
+ xcodebuild -version|head -n1|sed 's,.* ,0000,;s,\.,,g;s,.*\(....\)$,\1,'
Mark Mentovai 2014/03/06 17:27:29 This works for me locally too, but I have Xcode 5
sdefresne 2014/03/07 21:16:11 OK, there were multiple incorrect assumption in my
+}
+
+# Returns true if |string1| is smaller than |string2|.
+# This function assumes that both strings represent Xcode version numbers
+# as returned by |xcodeversion|.
+function smaller() {
+ local min="$(echo -ne "${1}\n${2}\n"|sort -n|head -n1)"
Mark Mentovai 2014/03/06 17:27:29 Can you put some spaces around your pipes for read
sdefresne 2014/03/07 21:16:11 Done.
+ test "${min}" != "${2}"
+}
+
+# If Xcode version is older than 5.0.0, check that SDKROOT is set but empty.
+# Otherwise, check that it is set to "xcodebuild -version -sdk '' Path".
+if smaller "$(xcodeversion)" "0500"; then
+ [[ ! ${SDKROOT} && ${SDKROOT-_} ]]
+else
+ [[ "${SDKROOT}" == "$(xcodebuild -version -sdk '' Path)" ]]
+fi

Powered by Google App Engine
This is Rietveld 408576698