Mathieu Chartier | 19510f0 | 2015-05-26 14:44:35 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 | |
Vladimir Marko | 1352f13 | 2017-04-28 15:28:29 +0100 | [diff] [blame] | 17 | #include "oatdump_test.h" |
Mathieu Chartier | 19510f0 | 2015-05-26 14:44:35 -0700 | [diff] [blame] | 18 | |
| 19 | namespace art { |
| 20 | |
Vladimir Marko | 7da3170 | 2016-03-29 18:42:21 +0100 | [diff] [blame] | 21 | // Disable tests on arm and mips as they are taking too long to run. b/27824283. |
| 22 | #if !defined(__arm__) && !defined(__mips__) |
Mathieu Chartier | 19510f0 | 2015-05-26 14:44:35 -0700 | [diff] [blame] | 23 | TEST_F(OatDumpTest, TestNoDumpVmap) { |
| 24 | std::string error_msg; |
Roland Levillain | 04147ef | 2016-09-06 11:09:41 +0100 | [diff] [blame] | 25 | ASSERT_TRUE(Exec(kDynamic, kModeArt, {"--no-dump:vmap"}, kListAndCode, &error_msg)) << error_msg; |
| 26 | } |
| 27 | TEST_F(OatDumpTest, TestNoDumpVmapStatic) { |
| 28 | TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS(); |
| 29 | std::string error_msg; |
| 30 | ASSERT_TRUE(Exec(kStatic, kModeArt, {"--no-dump:vmap"}, kListAndCode, &error_msg)) << error_msg; |
Mathieu Chartier | 19510f0 | 2015-05-26 14:44:35 -0700 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | TEST_F(OatDumpTest, TestNoDisassemble) { |
| 34 | std::string error_msg; |
Roland Levillain | 04147ef | 2016-09-06 11:09:41 +0100 | [diff] [blame] | 35 | ASSERT_TRUE(Exec(kDynamic, kModeArt, {"--no-disassemble"}, kListAndCode, &error_msg)) |
| 36 | << error_msg; |
| 37 | } |
| 38 | TEST_F(OatDumpTest, TestNoDisassembleStatic) { |
| 39 | TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS(); |
| 40 | std::string error_msg; |
| 41 | ASSERT_TRUE(Exec(kStatic, kModeArt, {"--no-disassemble"}, kListAndCode, &error_msg)) << error_msg; |
Mathieu Chartier | 19510f0 | 2015-05-26 14:44:35 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | TEST_F(OatDumpTest, TestListClasses) { |
| 45 | std::string error_msg; |
Roland Levillain | 04147ef | 2016-09-06 11:09:41 +0100 | [diff] [blame] | 46 | ASSERT_TRUE(Exec(kDynamic, kModeArt, {"--list-classes"}, kListOnly, &error_msg)) << error_msg; |
| 47 | } |
| 48 | TEST_F(OatDumpTest, TestListClassesStatic) { |
| 49 | TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS(); |
| 50 | std::string error_msg; |
| 51 | ASSERT_TRUE(Exec(kStatic, kModeArt, {"--list-classes"}, kListOnly, &error_msg)) << error_msg; |
Mathieu Chartier | 19510f0 | 2015-05-26 14:44:35 -0700 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | TEST_F(OatDumpTest, TestListMethods) { |
| 55 | std::string error_msg; |
Roland Levillain | 04147ef | 2016-09-06 11:09:41 +0100 | [diff] [blame] | 56 | ASSERT_TRUE(Exec(kDynamic, kModeArt, {"--list-methods"}, kListOnly, &error_msg)) << error_msg; |
| 57 | } |
| 58 | TEST_F(OatDumpTest, TestListMethodsStatic) { |
| 59 | TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS(); |
| 60 | std::string error_msg; |
| 61 | ASSERT_TRUE(Exec(kStatic, kModeArt, {"--list-methods"}, kListOnly, &error_msg)) << error_msg; |
Mathieu Chartier | 19510f0 | 2015-05-26 14:44:35 -0700 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | TEST_F(OatDumpTest, TestSymbolize) { |
| 65 | std::string error_msg; |
Roland Levillain | 04147ef | 2016-09-06 11:09:41 +0100 | [diff] [blame] | 66 | ASSERT_TRUE(Exec(kDynamic, kModeSymbolize, {}, kListOnly, &error_msg)) << error_msg; |
| 67 | } |
| 68 | TEST_F(OatDumpTest, TestSymbolizeStatic) { |
| 69 | TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS(); |
| 70 | std::string error_msg; |
| 71 | ASSERT_TRUE(Exec(kStatic, kModeSymbolize, {}, kListOnly, &error_msg)) << error_msg; |
Mathieu Chartier | 19510f0 | 2015-05-26 14:44:35 -0700 | [diff] [blame] | 72 | } |
Anestis Bechtsoudis | a1f56a8 | 2017-10-08 23:37:10 +0300 | [diff] [blame] | 73 | |
| 74 | TEST_F(OatDumpTest, TestExportDex) { |
Mathieu Chartier | 567dc6f | 2018-04-05 16:37:14 -0700 | [diff] [blame] | 75 | // Test is failing on target, b/77469384. |
| 76 | TEST_DISABLED_FOR_TARGET(); |
Anestis Bechtsoudis | a1f56a8 | 2017-10-08 23:37:10 +0300 | [diff] [blame] | 77 | std::string error_msg; |
| 78 | ASSERT_TRUE(Exec(kDynamic, kModeOat, {"--export-dex-to=" + tmp_dir_}, kListOnly, &error_msg)) |
| 79 | << error_msg; |
Mathieu Chartier | 567dc6f | 2018-04-05 16:37:14 -0700 | [diff] [blame] | 80 | const std::string dex_location = tmp_dir_+ "/core-oj-hostdex.jar_export.dex"; |
| 81 | const std::string dexdump2 = GetExecutableFilePath("dexdump2", |
| 82 | /*is_debug*/false, |
| 83 | /*is_static*/false); |
| 84 | ASSERT_TRUE(ForkAndExecAndWait({dexdump2, "-d", dex_location}, &error_msg)) << error_msg; |
Anestis Bechtsoudis | a1f56a8 | 2017-10-08 23:37:10 +0300 | [diff] [blame] | 85 | } |
| 86 | TEST_F(OatDumpTest, TestExportDexStatic) { |
| 87 | TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS(); |
| 88 | std::string error_msg; |
| 89 | ASSERT_TRUE(Exec(kStatic, kModeOat, {"--export-dex-to=" + tmp_dir_}, kListOnly, &error_msg)) |
| 90 | << error_msg; |
| 91 | } |
Nicolas Geoffray | 973ce7c | 2016-03-24 09:23:04 +0000 | [diff] [blame] | 92 | #endif |
Mathieu Chartier | 19510f0 | 2015-05-26 14:44:35 -0700 | [diff] [blame] | 93 | } // namespace art |