Vladimir Marko | 421087b | 2018-02-27 11:00:17 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "oatdump_test.h" |
| 18 | |
| 19 | namespace art { |
| 20 | |
| 21 | TEST_F(OatDumpTest, TestAppWithBootImage) { |
Vladimir Marko | a64c1ad | 2021-03-08 14:27:05 +0000 | [diff] [blame] | 22 | ASSERT_TRUE(GenerateAppOdexFile(Flavor::kDynamic, {"--runtime-arg", "-Xmx64M"})); |
| 23 | ASSERT_TRUE(Exec(Flavor::kDynamic, kModeOatWithBootImage, {}, kListAndCode)); |
Vladimir Marko | 421087b | 2018-02-27 11:00:17 +0000 | [diff] [blame] | 24 | } |
| 25 | TEST_F(OatDumpTest, TestAppWithBootImageStatic) { |
| 26 | TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS(); |
Vladimir Marko | a64c1ad | 2021-03-08 14:27:05 +0000 | [diff] [blame] | 27 | ASSERT_TRUE(GenerateAppOdexFile(Flavor::kStatic, {"--runtime-arg", "-Xmx64M"})); |
| 28 | ASSERT_TRUE(Exec(Flavor::kStatic, kModeOatWithBootImage, {}, kListAndCode)); |
Vladimir Marko | 421087b | 2018-02-27 11:00:17 +0000 | [diff] [blame] | 29 | } |
| 30 | |
Vladimir Marko | ffe26cc | 2019-02-26 09:51:56 +0000 | [diff] [blame] | 31 | TEST_F(OatDumpTest, TestAppImageWithBootImage) { |
| 32 | TEST_DISABLED_WITHOUT_BAKER_READ_BARRIERS(); // GC bug, b/126305867 |
| 33 | const std::string app_image_arg = "--app-image-file=" + GetAppImageName(); |
Vladimir Marko | a64c1ad | 2021-03-08 14:27:05 +0000 | [diff] [blame] | 34 | ASSERT_TRUE(GenerateAppOdexFile(Flavor::kDynamic, {"--runtime-arg", "-Xmx64M", app_image_arg})); |
| 35 | ASSERT_TRUE(Exec(Flavor::kDynamic, kModeAppImage, {}, kListAndCode)); |
Vladimir Marko | ffe26cc | 2019-02-26 09:51:56 +0000 | [diff] [blame] | 36 | } |
| 37 | TEST_F(OatDumpTest, TestAppImageWithBootImageStatic) { |
| 38 | TEST_DISABLED_WITHOUT_BAKER_READ_BARRIERS(); // GC bug, b/126305867 |
| 39 | TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS(); |
| 40 | const std::string app_image_arg = "--app-image-file=" + GetAppImageName(); |
Vladimir Marko | a64c1ad | 2021-03-08 14:27:05 +0000 | [diff] [blame] | 41 | ASSERT_TRUE(GenerateAppOdexFile(Flavor::kStatic, {"--runtime-arg", "-Xmx64M", app_image_arg})); |
| 42 | ASSERT_TRUE(Exec(Flavor::kStatic, kModeAppImage, {}, kListAndCode)); |
Vladimir Marko | ffe26cc | 2019-02-26 09:51:56 +0000 | [diff] [blame] | 43 | } |
| 44 | |
Mathieu Chartier | 6b689ce | 2019-07-18 14:17:47 -0700 | [diff] [blame] | 45 | TEST_F(OatDumpTest, TestAppImageInvalidPath) { |
| 46 | TEST_DISABLED_WITHOUT_BAKER_READ_BARRIERS(); // GC bug, b/126305867 |
| 47 | TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS(); |
| 48 | const std::string app_image_arg = "--app-image-file=" + GetAppImageName(); |
Vladimir Marko | a64c1ad | 2021-03-08 14:27:05 +0000 | [diff] [blame] | 49 | ASSERT_TRUE(GenerateAppOdexFile(Flavor::kStatic, {"--runtime-arg", "-Xmx64M", app_image_arg})); |
Mathieu Chartier | 6b689ce | 2019-07-18 14:17:47 -0700 | [diff] [blame] | 50 | SetAppImageName("missing_app_image.art"); |
Vladimir Marko | a64c1ad | 2021-03-08 14:27:05 +0000 | [diff] [blame] | 51 | ASSERT_TRUE(Exec(Flavor::kStatic, kModeAppImage, {}, kListAndCode, /*expect_failure=*/true)); |
Mathieu Chartier | 6b689ce | 2019-07-18 14:17:47 -0700 | [diff] [blame] | 52 | } |
| 53 | |
Vladimir Marko | 421087b | 2018-02-27 11:00:17 +0000 | [diff] [blame] | 54 | } // namespace art |