blob: b4eddb91f98143a28ef65869316a769ce2e7e4d7 [file] [log] [blame]
Mathieu Chartier19510f02015-05-26 14:44:35 -07001/*
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 Marko1352f132017-04-28 15:28:29 +010017#include "oatdump_test.h"
Mathieu Chartier19510f02015-05-26 14:44:35 -070018
19namespace art {
20
Vladimir Marko7da31702016-03-29 18:42:21 +010021// Disable tests on arm and mips as they are taking too long to run. b/27824283.
22#if !defined(__arm__) && !defined(__mips__)
Mathieu Chartier19510f02015-05-26 14:44:35 -070023TEST_F(OatDumpTest, TestNoDumpVmap) {
24 std::string error_msg;
Roland Levillain04147ef2016-09-06 11:09:41 +010025 ASSERT_TRUE(Exec(kDynamic, kModeArt, {"--no-dump:vmap"}, kListAndCode, &error_msg)) << error_msg;
26}
27TEST_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 Chartier19510f02015-05-26 14:44:35 -070031}
32
33TEST_F(OatDumpTest, TestNoDisassemble) {
34 std::string error_msg;
Roland Levillain04147ef2016-09-06 11:09:41 +010035 ASSERT_TRUE(Exec(kDynamic, kModeArt, {"--no-disassemble"}, kListAndCode, &error_msg))
36 << error_msg;
37}
38TEST_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 Chartier19510f02015-05-26 14:44:35 -070042}
43
44TEST_F(OatDumpTest, TestListClasses) {
45 std::string error_msg;
Roland Levillain04147ef2016-09-06 11:09:41 +010046 ASSERT_TRUE(Exec(kDynamic, kModeArt, {"--list-classes"}, kListOnly, &error_msg)) << error_msg;
47}
48TEST_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 Chartier19510f02015-05-26 14:44:35 -070052}
53
54TEST_F(OatDumpTest, TestListMethods) {
55 std::string error_msg;
Roland Levillain04147ef2016-09-06 11:09:41 +010056 ASSERT_TRUE(Exec(kDynamic, kModeArt, {"--list-methods"}, kListOnly, &error_msg)) << error_msg;
57}
58TEST_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 Chartier19510f02015-05-26 14:44:35 -070062}
63
64TEST_F(OatDumpTest, TestSymbolize) {
65 std::string error_msg;
Roland Levillain04147ef2016-09-06 11:09:41 +010066 ASSERT_TRUE(Exec(kDynamic, kModeSymbolize, {}, kListOnly, &error_msg)) << error_msg;
67}
68TEST_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 Chartier19510f02015-05-26 14:44:35 -070072}
Anestis Bechtsoudisa1f56a82017-10-08 23:37:10 +030073
74TEST_F(OatDumpTest, TestExportDex) {
Mathieu Chartier567dc6f2018-04-05 16:37:14 -070075 // Test is failing on target, b/77469384.
76 TEST_DISABLED_FOR_TARGET();
Anestis Bechtsoudisa1f56a82017-10-08 23:37:10 +030077 std::string error_msg;
78 ASSERT_TRUE(Exec(kDynamic, kModeOat, {"--export-dex-to=" + tmp_dir_}, kListOnly, &error_msg))
79 << error_msg;
Mathieu Chartier567dc6f2018-04-05 16:37:14 -070080 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 Bechtsoudisa1f56a82017-10-08 23:37:10 +030085}
86TEST_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 Geoffray973ce7c2016-03-24 09:23:04 +000092#endif
Mathieu Chartier19510f02015-05-26 14:44:35 -070093} // namespace art