diff options
author | 2015-12-18 01:49:38 +0000 | |
---|---|---|
committer | 2015-12-18 01:49:38 +0000 | |
commit | f1e91bfa95d04c94d82baea605533fa3f9e0268f (patch) | |
tree | 498ca5e4627971e033f7855f2e5cf186c8ce60c2 /runtime/parsed_options_test.cc | |
parent | e38c254052b3f2f4f4b283079f070c024d86dc63 (diff) | |
parent | db2980ae9eca19a577df27b1f05912ed482fb88c (diff) |
Merge "ART: Refactor CommonRuntimeTest::SetUp" am: fae1db92d8
am: db2980ae9e
* commit 'db2980ae9eca19a577df27b1f05912ed482fb88c':
ART: Refactor CommonRuntimeTest::SetUp
Diffstat (limited to 'runtime/parsed_options_test.cc')
-rw-r--r-- | runtime/parsed_options_test.cc | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/runtime/parsed_options_test.cc b/runtime/parsed_options_test.cc index b2240cb6a6..5b90c6adad 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 { @@ -123,6 +125,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 |