diff options
author | 2015-12-17 19:02:47 +0000 | |
---|---|---|
committer | 2015-12-17 19:02:47 +0000 | |
commit | db2980ae9eca19a577df27b1f05912ed482fb88c (patch) | |
tree | f34df405cf1a6762ea2326edfc8d6d0128439969 /runtime/parsed_options_test.cc | |
parent | bb88f60af2260cca9f5433a02b30bc0f6edea076 (diff) | |
parent | fae1db92d8433d0f75258c190bcf2c940731f036 (diff) |
Merge "ART: Refactor CommonRuntimeTest::SetUp"
am: fae1db92d8
* commit 'fae1db92d8433d0f75258c190bcf2c940731f036':
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 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 |