Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 1 | // Copyright (C) 2016 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 | package art |
| 16 | |
Colin Cross | 6e95dd5 | 2016-09-12 15:37:10 -0700 | [diff] [blame] | 17 | import ( |
David Srbecky | b0713ca | 2020-07-01 15:04:39 +0100 | [diff] [blame] | 18 | "path/filepath" |
Colin Cross | 6e95dd5 | 2016-09-12 15:37:10 -0700 | [diff] [blame] | 19 | "sort" |
| 20 | "strings" |
| 21 | |
| 22 | "android/soong/android" |
David Srbecky | 7400a54 | 2020-07-09 13:40:57 +0100 | [diff] [blame] | 23 | "android/soong/cc/config" |
Colin Cross | 6e95dd5 | 2016-09-12 15:37:10 -0700 | [diff] [blame] | 24 | ) |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 25 | |
| 26 | var ( |
David Srbecky | b461b53 | 2020-07-13 17:45:22 +0000 | [diff] [blame] | 27 | pctx = android.NewPackageContext("android/soong/art") |
| 28 | |
| 29 | // Copy the following prebuilts to the testcases directory. |
| 30 | // The original prebuilts directory is not accessible when running tests remotely. |
| 31 | prebuiltToolsForTests = []string{ |
| 32 | "bin/clang", |
| 33 | "bin/clang.real", |
| 34 | "bin/llvm-addr2line", |
| 35 | "bin/llvm-dwarfdump", |
| 36 | "bin/llvm-objdump", |
| 37 | "lib64/libc++.so.1", |
| 38 | } |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 39 | ) |
| 40 | |
| 41 | func init() { |
| 42 | android.RegisterMakeVarsProvider(pctx, makeVarsProvider) |
David Srbecky | b0713ca | 2020-07-01 15:04:39 +0100 | [diff] [blame] | 43 | pctx.Import("android/soong/cc/config") |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | func makeVarsProvider(ctx android.MakeVarsContext) { |
| 47 | ctx.Strict("LIBART_IMG_HOST_BASE_ADDRESS", ctx.Config().LibartImgHostBaseAddress()) |
| 48 | ctx.Strict("LIBART_IMG_TARGET_BASE_ADDRESS", ctx.Config().LibartImgDeviceBaseAddress()) |
Colin Cross | 6e95dd5 | 2016-09-12 15:37:10 -0700 | [diff] [blame] | 49 | |
| 50 | testMap := testMap(ctx.Config()) |
| 51 | var testNames []string |
| 52 | for name := range testMap { |
| 53 | testNames = append(testNames, name) |
| 54 | } |
| 55 | |
| 56 | sort.Strings(testNames) |
| 57 | |
| 58 | for _, name := range testNames { |
| 59 | ctx.Strict("ART_TEST_LIST_"+name, strings.Join(testMap[name], " ")) |
| 60 | } |
David Srbecky | 1cf46a3 | 2020-06-22 15:39:00 +0100 | [diff] [blame] | 61 | |
| 62 | // Create list of copy commands to install the content of the testcases directory. |
| 63 | testcasesContent := testcasesContent(ctx.Config()) |
| 64 | copy_cmds := []string{} |
| 65 | for _, key := range android.SortedStringKeys(testcasesContent) { |
| 66 | copy_cmds = append(copy_cmds, testcasesContent[key]+":"+key) |
| 67 | } |
| 68 | ctx.Strict("ART_TESTCASES_CONTENT", strings.Join(copy_cmds, " ")) |
David Srbecky | b0713ca | 2020-07-01 15:04:39 +0100 | [diff] [blame] | 69 | |
| 70 | // Add prebuilt tools. |
David Srbecky | 7400a54 | 2020-07-09 13:40:57 +0100 | [diff] [blame] | 71 | clang_path := filepath.Join(config.ClangDefaultBase, ctx.Config().PrebuiltOS(), config.ClangDefaultVersion) |
David Srbecky | b0713ca | 2020-07-01 15:04:39 +0100 | [diff] [blame] | 72 | copy_cmds = []string{} |
David Srbecky | b461b53 | 2020-07-13 17:45:22 +0000 | [diff] [blame] | 73 | for _, tool := range prebuiltToolsForTests { |
| 74 | src := filepath.Join(clang_path, "/", tool) |
| 75 | copy_cmds = append(copy_cmds, src+":"+src) |
David Srbecky | b0713ca | 2020-07-01 15:04:39 +0100 | [diff] [blame] | 76 | } |
| 77 | ctx.Strict("ART_TESTCASES_PREBUILT_CONTENT", strings.Join(copy_cmds, " ")) |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 78 | } |