1// Copyright (C) 2020 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15// The below module creates a standalone zip that end-to-end tests can depend 16// on for running the suite. This is a workaround since we can't use csuite.zip 17// which is defined in an external Makefile that Soong can't depend on. 18// 19// Besides listing jars we know the launcher script depends on which is 20// brittle, this is a hack for several reasons. First, we're listing our 21// dependencies in the tools attribute when we should be using the 'srcs' 22// attribute. Second, we're accessing jars using a path relative to a known 23// artifact location instead of using the Soong 'location' feature. 24 25package { 26 default_applicable_licenses: ["Android-Apache-2.0"], 27} 28 29java_genrule_host { 30 name: "csuite_standalone_zip", 31 cmd: "ANDROID_CSUITE=$(genDir)/android-csuite && " + 32 "CSUITE_TOOLS=$${ANDROID_CSUITE}/tools && " + 33 "CSUITE_TESTCASES=$${ANDROID_CSUITE}/testcases && " + 34 "ANDROID_HOST_OUT=$$(dirname $(location :csuite-tradefed))/.. && " + 35 "rm -rf $${CSUITE_TOOLS} && mkdir -p $${CSUITE_TOOLS} && " + 36 "rm -rf $${CSUITE_TESTCASES} && mkdir -p $${CSUITE_TESTCASES} && " + 37 "cp $(location :csuite-tradefed) $${CSUITE_TOOLS} && " + 38 "cp $${ANDROID_HOST_OUT}/framework/csuite-tradefed.jar $${CSUITE_TOOLS} && " + 39 "cp $(location :tradefed) $${CSUITE_TOOLS} && " + 40 "cp $(location :compatibility-host-util) $${CSUITE_TOOLS} && " + 41 "cp $(location :csuite-app-launch) $${CSUITE_TESTCASES} && " + 42 // We skip copying the csuite-tradefed-tests jar since its location is 43 // not straight-forward to deduce and not really necessary. 44 "touch $${CSUITE_TOOLS}/csuite-tradefed-tests.jar && " + 45 "chmod a+x $${CSUITE_TOOLS}/csuite-tradefed && " + 46 "$(location soong_zip) -o $(out) -d -C $(genDir) -D $${ANDROID_CSUITE}", 47 out: ["csuite-standalone.zip"], 48 srcs: [ 49 ":tradefed", 50 ":compatibility-host-util", 51 ":csuite-app-launch", 52 ], 53 tools: [ 54 "soong_zip", 55 ":csuite-tradefed", 56 ], 57} 58 59python_library_host { 60 name: "csuite_test_utils", 61 srcs: [ 62 "csuite_test_utils.py", 63 ], 64 defaults: [ 65 "csuite_python_defaults", 66 ], 67 java_data: [ 68 "csuite_standalone_zip", 69 ], 70 libs: [ 71 "csuite_test", 72 ], 73} 74 75python_test_host { 76 name: "csuite_cli_test", 77 srcs: [ 78 "csuite_cli_test.py", 79 ], 80 test_config_template: "csuite_test_template.xml", 81 test_suites: [ 82 "general-tests", 83 ], 84 libs: [ 85 "csuite_test_utils", 86 ], 87 defaults: [ 88 "csuite_python_defaults", 89 ], 90} 91 92python_test_host { 93 name: "csuite_crash_detection_test", 94 srcs: [ 95 "csuite_crash_detection_test.py", 96 ], 97 test_config_template: "csuite_test_template.xml", 98 test_suites: [ 99 "general-tests", 100 ], 101 libs: [ 102 "csuite_test_utils", 103 ], 104 data: [ 105 ":csuite_crash_on_launch_test_app", 106 ":csuite_no_crash_test_app", 107 ], 108 defaults: [ 109 "csuite_python_defaults", 110 ], 111 test_options: { 112 unit_test: false, 113 }, 114} 115