From e46b580c672e721a6222c83d3e8c111add18e4f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 26 Jul 2016 12:30:20 +0200 Subject: [build] unify naming of Makefile targets `make foo` just builds `make run-foo` builds and runs --- ARCHITECTURE.md | 2 +- Makefile | 49 +++++++++++++++++++++++++++------------------ platform/ios/DEVELOPING.md | 2 +- platform/ios/bitrise.yml | 2 +- platform/qt/README.md | 4 ++++ test/api/render_missing.cpp | 1 + 6 files changed, 37 insertions(+), 23 deletions(-) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 590ea97722..b3c44c62c9 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -18,7 +18,7 @@ The mapbox-gl-native build system uses a variety of tools. ## Make -GNU Make and a master `Makefile` serves as the coordinating tool for all other build system tools. Most of your interaction with the build system will be via `make` commands. We aim to have a consistent pattern for make targets across platforms: for a given platform, e.g. `ios`, `make ios` builds a reasonable set of end products (though perhaps not all permutations of build options, which can be prohibitively expensive), and `make test-ios` runs a complete test suite for the platform. +GNU Make and a master `Makefile` serves as the coordinating tool for all other build system tools. Most of your interaction with the build system will be via `make` commands. We aim to have a consistent pattern for make targets across platforms: for a given platform, e.g. `ios`, `make ios` builds a reasonable set of end products (though perhaps not all permutations of build options, which can be prohibitively expensive), and `make ios-test` runs a complete test suite for the platform. ## Git submodules diff --git a/Makefile b/Makefile index a7b5fe952c..25325612e0 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ else endif .PHONY: default -default: test-$(BUILD_PLATFORM) +default: test ifneq (,$(wildcard .git/.)) .mason/mason: @@ -109,16 +109,24 @@ macos: $(MACOS_PROJ_PATH) xproj: $(MACOS_PROJ_PATH) open $(MACOS_WORK_PATH) -.PHONY: test-macos -test-macos: $(MACOS_PROJ_PATH) +.PHONY: test +test: $(MACOS_PROJ_PATH) set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'mbgl-test' build $(XCPRETTY) - ulimit -c unlimited && ($(MACOS_OUTPUT_PATH)/$(BUILDTYPE)/mbgl-test & pid=$$! && wait $$pid \ + +.PHONY: run-test +run-test: run-test-* + +run-test-%: test + ulimit -c unlimited && ($(MACOS_OUTPUT_PATH)/$(BUILDTYPE)/mbgl-test --gtest_catch_exceptions=0 --gtest_filter=$* & pid=$$! && wait $$pid \ || (lldb -c /cores/core.$$pid --batch --one-line 'thread backtrace all' --one-line 'quit' && exit 1)) set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'CI' test $(XCPRETTY) .PHONY: glfw-app glfw-app: $(MACOS_PROJ_PATH) set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'mbgl-glfw' build $(XCPRETTY) + +.PHONY: run-glfw-app +run-glfw-app: glfw-app "$(MACOS_OUTPUT_PATH)/$(BUILDTYPE)/mbgl-glfw" .PHONY: render @@ -210,8 +218,8 @@ ios: $(IOS_PROJ_PATH) iproj: $(IOS_PROJ_PATH) open $(IOS_WORK_PATH) -.PHONY: test-ios -test-ios: $(IOS_PROJ_PATH) +.PHONY: ios-test +ios-test: $(IOS_PROJ_PATH) set -o pipefail && $(IOS_XCODEBUILD_SIM) -scheme 'CI' test $(XCPRETTY) .PHONY: ipackage @@ -264,13 +272,25 @@ $(LINUX_BUILD): $(BUILD_DEPS) .PHONY: linux linux: glfw-app render offline -test-linux: run-test-* +.PHONY: test +test: $(LINUX_BUILD) + $(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-test + +ifneq (,$(shell which gdb)) + GDB = gdb -batch -return-child-result -ex 'set print thread-events off' -ex 'run' -ex 'thread apply all bt' --args +endif + +.PHONY: run-test +run-test: run-test-* -.PHONY: linux-render +run-test-%: test + $(GDB) $(LINUX_OUTPUT_PATH)/mbgl-test --gtest_catch_exceptions=0 --gtest_filter=$* + +.PHONY: render render: $(LINUX_BUILD) $(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-render -.PHONY: linux-offline +.PHONY: offline offline: $(LINUX_BUILD) $(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-offline @@ -278,10 +298,6 @@ offline: $(LINUX_BUILD) glfw-app: $(LINUX_BUILD) $(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-glfw -.PHONY: test -test: $(LINUX_BUILD) - $(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-test - .PHONY: run-glfw-app run-glfw-app: glfw-app cd $(LINUX_OUTPUT_PATH) && ./mbgl-glfw @@ -290,13 +306,6 @@ run-glfw-app: glfw-app node: $(LINUX_BUILD) $(NINJA) -j$(JOBS) -C $(LINUX_OUTPUT_PATH) mbgl-node -ifneq (,$(shell which gdb)) - GDB = gdb -batch -return-child-result -ex 'set print thread-events off' -ex 'run' -ex 'thread apply all bt' --args -endif - -run-test-%: test - $(GDB) $(LINUX_OUTPUT_PATH)/mbgl-test --gtest_catch_exceptions=0 --gtest_filter=$* - .PHONY: compdb compdb: $(LINUX_BUILD) # Ninja generator already outputs the file at the right location diff --git a/platform/ios/DEVELOPING.md b/platform/ios/DEVELOPING.md index d78518eddd..5ba6871959 100644 --- a/platform/ios/DEVELOPING.md +++ b/platform/ios/DEVELOPING.md @@ -108,7 +108,7 @@ To add or update text that the user may see in the iOS SDK: ## Testing -`make test-ios` builds and runs unit tests of cross-platform code as well as the SDK. +`make ios-test` builds and runs unit tests of cross-platform code as well as the SDK. Before you can run unit tests of the cross-platform code on the command line, install ios-sim version 3.2.0 (not any other version): diff --git a/platform/ios/bitrise.yml b/platform/ios/bitrise.yml index f87a97b7d6..d610869cb3 100644 --- a/platform/ios/bitrise.yml +++ b/platform/ios/bitrise.yml @@ -36,7 +36,7 @@ workflows: gem install jazzy --no-rdoc --no-ri export BUILDTYPE=Debug make ios - make test-ios + make ios-test - is_debug: 'yes' - slack: title: Post to Slack diff --git a/platform/qt/README.md b/platform/qt/README.md index e5ec7e3bb0..dcd394ec36 100644 --- a/platform/qt/README.md +++ b/platform/qt/README.md @@ -53,6 +53,10 @@ For macOS desktop, you can install Qt 5 via [Homebrew](http://brew.sh): brew install qt5 +Since Homebrew doesn't add Qt to the path, you'll have to do that manually before running any Make target: + + export PATH=/usr/local/opt/qt5:$PATH + We provide the following build targets for our Qt SDK: ### Build instructions diff --git a/test/api/render_missing.cpp b/test/api/render_missing.cpp index 135c1ecae5..024ebd3729 100644 --- a/test/api/render_missing.cpp +++ b/test/api/render_missing.cpp @@ -40,6 +40,7 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) { std::string message; // This host does not respond (== connection error). + // Are you seeing this test fail? Make sure you don't have a server running on port 3001! map.setStyleJSON(style); map.renderStill([&](std::exception_ptr err, PremultipliedImage&&) { ASSERT_TRUE(err.operator bool()); -- cgit v1.2.1