summaryrefslogtreecommitdiffstats
path: root/tools/split-select/RuleGenerator_test.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2014-11-03 12:05:15 -0800
committerAdam Lesinski <adamlesinski@google.com>2014-11-03 12:09:58 -0800
commitc3dc0b57b8d0b3875f868788e110aa67fb032b4a (patch)
treed29bf5702b81c4f283ae5e463af00c1e9327d459 /tools/split-select/RuleGenerator_test.cpp
parent425b1dc88c47e0e9d3a653ad902a69f3ec09b966 (diff)
downloadframeworks_base-c3dc0b57b8d0b3875f868788e110aa67fb032b4a.zip
frameworks_base-c3dc0b57b8d0b3875f868788e110aa67fb032b4a.tar.gz
frameworks_base-c3dc0b57b8d0b3875f868788e110aa67fb032b4a.tar.bz2
Build the split-select tool without C++11 support
It was complicated to get the tool building on Windows, Linux, and OSX with C++11 support. OSX uses Clang to build C++11 binaries, which requires the libc++ standard library. Since most of the dependencies of this program are built against libstdc++, this was difficult to resolve. Now we build without C++11 support. Change-Id: I4e537c113734508a8f480a1c402ed237de4f0e60
Diffstat (limited to 'tools/split-select/RuleGenerator_test.cpp')
-rw-r--r--tools/split-select/RuleGenerator_test.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/tools/split-select/RuleGenerator_test.cpp b/tools/split-select/RuleGenerator_test.cpp
index 60baabe..ee387be 100644
--- a/tools/split-select/RuleGenerator_test.cpp
+++ b/tools/split-select/RuleGenerator_test.cpp
@@ -25,19 +25,19 @@ using namespace android;
namespace split {
static void expectDensityRule(const Vector<int>& densities, int density, int greaterThan, int lessThan);
-static void expectAbiRule(const Vector<abi::Variant>& abis, abi::Variant variant,
- std::initializer_list<const char*> matches);
+static void expectAbiRule(const Vector<abi::Variant>& abis, abi::Variant variant, const char* a);
+static void expectAbiRule(const Vector<abi::Variant>& abis, abi::Variant variant, const char* a, const char* b);
TEST(RuleGeneratorTest, testAbiRules) {
Vector<abi::Variant> abis;
- abis.add(abi::Variant::armeabi);
- abis.add(abi::Variant::armeabi_v7a);
- abis.add(abi::Variant::x86);
+ abis.add(abi::Variant_armeabi);
+ abis.add(abi::Variant_armeabi_v7a);
+ abis.add(abi::Variant_x86);
std::sort(abis.begin(), abis.end());
- expectAbiRule(abis, abi::Variant::armeabi, {"armeabi"});
- expectAbiRule(abis, abi::Variant::armeabi_v7a, {"armeabi-v7a", "arm64-v8a"});
- expectAbiRule(abis, abi::Variant::x86, {"x86", "x86_64"});
+ expectAbiRule(abis, abi::Variant_armeabi, "armeabi");
+ expectAbiRule(abis, abi::Variant_armeabi_v7a, "armeabi-v7a", "arm64-v8a");
+ expectAbiRule(abis, abi::Variant_x86, "x86", "x86_64");
}
TEST(RuleGeneratorTest, testDensityRules) {
@@ -126,8 +126,7 @@ static void expectDensityRule(const Vector<int>& densities, int density, int gre
}
}
-static void expectAbiRule(const Vector<abi::Variant>& abis, abi::Variant variant,
- std::initializer_list<const char*> matches) {
+static void expectAbiRule(const Vector<abi::Variant>& abis, abi::Variant variant, const Vector<const char*>& matches) {
const abi::Variant* iter = std::find(abis.begin(), abis.end(), variant);
if (abis.end() == iter) {
ADD_FAILURE() << abi::toString(variant) << " was not in the abi list.";
@@ -143,7 +142,9 @@ static void expectAbiRule(const Vector<abi::Variant>& abis, abi::Variant variant
EXPECT_EQ(matches.size(), rule->stringArgs.size())
<< " for " << abi::toString(variant) << " rule";
- for (const char* match : matches) {
+ const size_t matchCount = matches.size();
+ for (size_t i = 0; i < matchCount; i++) {
+ const char* match = matches[i];
if (rule->stringArgs.end() ==
std::find(rule->stringArgs.begin(), rule->stringArgs.end(), String8(match))) {
ADD_FAILURE() << "Rule for abi " << abi::toString(variant)
@@ -152,4 +153,17 @@ static void expectAbiRule(const Vector<abi::Variant>& abis, abi::Variant variant
}
}
+static void expectAbiRule(const Vector<abi::Variant>& abis, abi::Variant variant, const char* a) {
+ Vector<const char*> matches;
+ matches.add(a);
+ expectAbiRule(abis, variant, matches);
+}
+
+static void expectAbiRule(const Vector<abi::Variant>& abis, abi::Variant variant, const char* a, const char* b) {
+ Vector<const char*> matches;
+ matches.add(a);
+ matches.add(b);
+ expectAbiRule(abis, variant, matches);
+}
+
} // namespace split