summaryrefslogtreecommitdiff
path: root/runtime/parsed_options_test.cc
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2015-12-16 16:54:35 -0800
committer Andreas Gampe <agampe@google.com> 2015-12-17 10:41:13 -0800
commita00f012660e9a4baa34c0ab96042f7146e9a6017 (patch)
tree7091c01a3119a2353884c592956279252386c890 /runtime/parsed_options_test.cc
parentcbf8af898e758cef27687c20c8cf9ac75280026d (diff)
ART: Refactor CommonRuntimeTest::SetUp
Factor out finishing up the runtime. This code will execute the interpreter to initialize important classes etc., which is not necessary for testing RuntimeMethod sizes and trampoline entrypoints, in fact it may violate pointer-size invariants. Also add InstructionSet parsing tests to the ParsedOptions test. Change-Id: I75cd00c6d358e1bc962c8f1845244f6400c1cd6c
Diffstat (limited to 'runtime/parsed_options_test.cc')
-rw-r--r--runtime/parsed_options_test.cc38
1 files changed, 37 insertions, 1 deletions
diff --git a/runtime/parsed_options_test.cc b/runtime/parsed_options_test.cc
index 06b40fd925..c32d76c715 100644
--- a/runtime/parsed_options_test.cc
+++ b/runtime/parsed_options_test.cc
@@ -18,6 +18,8 @@
#include <memory>
+#include "arch/instruction_set.h"
+#include "base/stringprintf.h"
#include "common_runtime_test.h"
namespace art {
@@ -113,6 +115,40 @@ TEST_F(ParsedOptionsTest, ParsedOptionsGc) {
EXPECT_TRUE(map.Exists(Opt::GcOption));
XGcOption xgc = map.GetOrDefault(Opt::GcOption);
- EXPECT_EQ(gc::kCollectorTypeMC, xgc.collector_type_);}
+ EXPECT_EQ(gc::kCollectorTypeMC, xgc.collector_type_);
+}
+
+TEST_F(ParsedOptionsTest, ParsedOptionsInstructionSet) {
+ using Opt = RuntimeArgumentMap;
+
+ {
+ // Nothing set, should be kRuntimeISA.
+ RuntimeOptions options;
+ RuntimeArgumentMap map;
+ bool parsed = ParsedOptions::Parse(options, false, &map);
+ ASSERT_TRUE(parsed);
+ InstructionSet isa = map.GetOrDefault(Opt::ImageInstructionSet);
+ EXPECT_EQ(kRuntimeISA, isa);
+ }
+
+ const char* isa_strings[] = { "arm", "arm64", "x86", "x86_64", "mips", "mips64" };
+ InstructionSet ISAs[] = { InstructionSet::kArm,
+ InstructionSet::kArm64,
+ InstructionSet::kX86,
+ InstructionSet::kX86_64,
+ InstructionSet::kMips,
+ InstructionSet::kMips64 };
+ static_assert(arraysize(isa_strings) == arraysize(ISAs), "Need same amount.");
+
+ for (size_t i = 0; i < arraysize(isa_strings); ++i) {
+ RuntimeOptions options;
+ options.push_back(std::make_pair("imageinstructionset", isa_strings[i]));
+ RuntimeArgumentMap map;
+ bool parsed = ParsedOptions::Parse(options, false, &map);
+ ASSERT_TRUE(parsed);
+ InstructionSet isa = map.GetOrDefault(Opt::ImageInstructionSet);
+ EXPECT_EQ(ISAs[i], isa);
+ }
+}
} // namespace art