diff options
author | Dan Willemsen <dwillemsen@google.com> | 2020-01-22 15:16:59 -0800 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2020-01-22 15:16:59 -0800 |
commit | 94ffa4eec5634522334e1977fa30756db220b24a (patch) | |
tree | a4eeb7ccfdedef31e5c3998cb11ba3fee2cf1d81 | |
parent | 106740c16e261d69cf82c93b6229140fff6baf73 (diff) | |
parent | 481836ec30e459040a50ebc803578bfd930b4145 (diff) | |
download | robolectric-shadows-94ffa4eec5634522334e1977fa30756db220b24a.tar.gz |
Only use $(shell) when necessary
am: 481836ec30
Change-Id: I44525ffe40e90eb270e33f947ada499d45b0455e
-rw-r--r-- | run_robolectric_module_tests.mk | 8 | ||||
-rw-r--r-- | run_robotests.mk | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/run_robolectric_module_tests.mk b/run_robolectric_module_tests.mk index 6e49e7555..1c190e38b 100644 --- a/run_robolectric_module_tests.mk +++ b/run_robolectric_module_tests.mk @@ -13,12 +13,14 @@ test_source_files := $(call find-files-in-subdirs, $(test_source_directory), "*T test_source_files := $(filter-out org/robolectric/shadows/SQLiteCursorTest.java, $(test_source_files)) # Build the command that honors the test class filter, if any. -test_filter_command := $(if $(ROBOTEST_FILTER),grep -E "$(ROBOTEST_FILTER)",cat) +test_filter_command := $(if $(ROBOTEST_FILTER),grep -E "$(ROBOTEST_FILTER)",) # Convert the test source file paths into package names by removing ".java" extension and replacing "/" with "." -test_class_names := $(subst /,., $(basename $(test_source_files))) +test_class_names := $(sort $(subst /,., $(basename $(test_source_files)))) # Remove whitespace and sort the tests in alphabetical order. -test_class_names := $(sort $(shell echo '$(test_class_names)' | tr ' ' '\n' | $(test_filter_command))) +ifdef test_filter_command + test_class_names := $(sort $(shell echo '$(test_class_names)' | tr ' ' '\n' | $(test_filter_command))) +endif include $(BUILD_SYSTEM)/base_rules.mk diff --git a/run_robotests.mk b/run_robotests.mk index 2b076b05f..67a794846 100644 --- a/run_robotests.mk +++ b/run_robotests.mk @@ -51,7 +51,7 @@ ifneq ($(DISABLE_ROBO_RUN_TESTS),true) my_timeout := $(if $(LOCAL_ROBOTEST_TIMEOUT),$(LOCAL_ROBOTEST_TIMEOUT),600) # Command to filter the list of test classes. # If not specified, defaults to including all the tests. - my_test_filter_command := $(if $(ROBOTEST_FILTER),grep -E "$(ROBOTEST_FILTER)",cat) + my_test_filter_command := $(if $(ROBOTEST_FILTER),grep -E "$(ROBOTEST_FILTER)",) # The directory containing the sources. my_instrument_makefile_dir := $(dir $(ALL_MODULES.$(LOCAL_TEST_PACKAGE).MAKEFILE)) @@ -90,8 +90,10 @@ ifneq ($(DISABLE_ROBO_RUN_TESTS),true) LOCAL_ROBOTEST_FILES := $(call find-files-in-subdirs,$(LOCAL_PATH)/src,*Test.java,.) endif # Convert the paths into package names by removing .java extension and replacing "/" with "." - my_tests := $(subst /,.,$(basename $(LOCAL_ROBOTEST_FILES))) - my_tests := $(sort $(shell echo '$(my_tests)' | tr ' ' '\n' | $(my_test_filter_command))) + my_tests := $(sort $(subst /,.,$(basename $(LOCAL_ROBOTEST_FILES)))) + ifdef my_test_filter_command + my_tests := $(sort $(shell echo '$(my_tests)' | tr ' ' '\n' | $(my_test_filter_command))) + endif # The source jars containing the tests. my_srcs_jars := \ $(foreach lib, \ |