Merge "localtime_r(3) should act as if it calls tzset(3)."
diff --git a/libc/arch-arm/cortex-a7/bionic/memcpy_base.S b/libc/arch-arm/cortex-a7/bionic/memcpy_base.S
index 1d152bb..4ff982b 100644
--- a/libc/arch-arm/cortex-a7/bionic/memcpy_base.S
+++ b/libc/arch-arm/cortex-a7/bionic/memcpy_base.S
@@ -101,16 +101,38 @@
vld1.8 {d0}, [r1]!
vst1.8 {d0}, [r0, :64]!
-2: // Make sure we have at least 64 bytes to copy.
+2: cmp r2, #256
+ ble .L_copy_loop
+
+ // Make sure DST is 64 BYTE aligned.
+ rsb r3, r0, #0
+ ands r3, r3, #0x30
+ beq .L_copy_loop
+
+ sub r2, r2, r3
+ cmp r3, #0x10
+ beq .L_copy_16
+
+ vld1.8 {d0 - d3}, [r1]!
+ vst1.8 {d0 - d3}, [r0, :128]!
+ ands r3, r3, #0x10
+ beq .L_copy_loop
+
+.L_copy_16:
+ vld1.8 {d0, d1}, [r1]!
+ vst1.8 {d0, d1}, [r0, :128]!
+
+.L_copy_loop:
+ // Make sure we have at least 64 bytes to copy.
subs r2, r2, #64
blo 2f
1: // The main loop copies 64 bytes at a time.
vld1.8 {d0 - d3}, [r1]!
- vld1.8 {d4 - d7}, [r1]!
+ vst1.8 {d0 - d3}, [r0, :128]!
pld [r1, #(64*4)]
subs r2, r2, #64
- vst1.8 {d0 - d3}, [r0, :128]!
+ vld1.8 {d4 - d7}, [r1]!
vst1.8 {d4 - d7}, [r0, :128]!
bhs 1b
diff --git a/libc/bionic/system_properties.cpp b/libc/bionic/system_properties.cpp
index e925d23..5aefbaf 100644
--- a/libc/bionic/system_properties.cpp
+++ b/libc/bionic/system_properties.cpp
@@ -56,6 +56,7 @@
#include "private/bionic_futex.h"
#include "private/bionic_lock.h"
#include "private/bionic_macros.h"
+#include "private/bionic_sdk_version.h"
#include "private/libc_logging.h"
static const char property_service_socket[] = "/dev/socket/" PROP_SERVICE_NAME;
@@ -1265,6 +1266,11 @@
const prop_info *__system_property_find_nth(unsigned n)
{
+ if (bionic_get_application_target_sdk_version() >= __ANDROID_API_O__) {
+ __libc_fatal("__system_property_find_nth is not supported since Android O,"
+ " please use __system_property_foreach instead.");
+ }
+
find_nth_cookie cookie(n);
const int err = __system_property_foreach(find_nth_fn, &cookie);
diff --git a/libc/include/sys/system_properties.h b/libc/include/sys/system_properties.h
index d3e0d8d..faed9a0 100644
--- a/libc/include/sys/system_properties.h
+++ b/libc/include/sys/system_properties.h
@@ -81,7 +81,8 @@
** is inefficient and order of results may change from call
** to call.
*/
-const prop_info *__system_property_find_nth(unsigned n);
+const prop_info *__system_property_find_nth(unsigned n)
+ __REMOVED_IN(26);
/* Pass a prop_info for each system property to the provided
** callback. Use __system_property_read() to read the value
diff --git a/libc/libc.arm.map b/libc/libc.arm.map
index f9c5ede..3ff7ead 100644
--- a/libc/libc.arm.map
+++ b/libc/libc.arm.map
@@ -186,19 +186,16 @@
__sym_ntos;
__sym_ston;
__system_properties_init;
- __system_property_add; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_area__; # var
__system_property_area_init; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_area_serial; # introduced=23
__system_property_find;
- __system_property_find_nth;
__system_property_foreach; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_get;
__system_property_read;
__system_property_serial; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_set; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
__system_property_set_filename; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
- __system_property_update; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_wait_any; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__timer_create; # arm x86 mips
__timer_delete; # arm x86 mips
@@ -1535,8 +1532,15 @@
wcswcs; # arm x86 mips
} LIBC_O;
+LIBC_DEPRECATED {
+ global:
+ __system_property_find_nth;
+};
+
LIBC_PLATFORM {
global:
+ __system_property_add;
+ __system_property_update;
android_net_res_stats_get_info_for_net;
android_net_res_stats_aggregate;
android_net_res_stats_get_usable_servers;
diff --git a/libc/libc.arm64.map b/libc/libc.arm64.map
index 179d8bf..a696c41 100644
--- a/libc/libc.arm64.map
+++ b/libc/libc.arm64.map
@@ -131,19 +131,16 @@
__sym_ntos;
__sym_ston;
__system_properties_init;
- __system_property_add; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_area__; # var
__system_property_area_init; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_area_serial; # introduced=23
__system_property_find;
- __system_property_find_nth;
__system_property_foreach; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_get;
__system_property_read;
__system_property_serial; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_set; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
__system_property_set_filename; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
- __system_property_update; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_wait_any; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__umask_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
__vsnprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
@@ -1252,8 +1249,15 @@
gMallocLeakZygoteChild;
} LIBC_O;
+LIBC_DEPRECATED {
+ global:
+ __system_property_find_nth;
+};
+
LIBC_PLATFORM {
global:
+ __system_property_add;
+ __system_property_update;
android_net_res_stats_get_info_for_net;
android_net_res_stats_aggregate;
android_net_res_stats_get_usable_servers;
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index f122937..391c65c 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -187,19 +187,16 @@
__sym_ntos;
__sym_ston;
__system_properties_init;
- __system_property_add; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_area__; # var
__system_property_area_init; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_area_serial; # introduced=23
__system_property_find;
- __system_property_find_nth;
__system_property_foreach; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_get;
__system_property_read;
__system_property_serial; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_set; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
__system_property_set_filename; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
- __system_property_update; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_wait_any; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__timer_create; # arm x86 mips
__timer_delete; # arm x86 mips
@@ -1561,8 +1558,15 @@
wcswcs; # arm x86 mips
} LIBC_O;
+LIBC_DEPRECATED {
+ global:
+ __system_property_find_nth;
+};
+
LIBC_PLATFORM {
global:
+ __system_property_add;
+ __system_property_update;
android_net_res_stats_get_info_for_net;
android_net_res_stats_aggregate;
android_net_res_stats_get_usable_servers;
diff --git a/libc/libc.mips.map b/libc/libc.mips.map
index a969703..c89b4ad 100644
--- a/libc/libc.mips.map
+++ b/libc/libc.mips.map
@@ -183,19 +183,16 @@
__sym_ntos;
__sym_ston;
__system_properties_init;
- __system_property_add; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_area__; # var
__system_property_area_init; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_area_serial; # introduced=23
__system_property_find;
- __system_property_find_nth;
__system_property_foreach; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_get;
__system_property_read;
__system_property_serial; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_set; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
__system_property_set_filename; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
- __system_property_update; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_wait_any; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__timer_create; # arm x86 mips
__timer_delete; # arm x86 mips
@@ -1376,8 +1373,15 @@
wcswcs; # arm x86 mips
} LIBC_O;
+LIBC_DEPRECATED {
+ global:
+ __system_property_find_nth;
+};
+
LIBC_PLATFORM {
global:
+ __system_property_add;
+ __system_property_update;
android_net_res_stats_get_info_for_net;
android_net_res_stats_aggregate;
android_net_res_stats_get_usable_servers;
diff --git a/libc/libc.mips64.map b/libc/libc.mips64.map
index 179d8bf..a696c41 100644
--- a/libc/libc.mips64.map
+++ b/libc/libc.mips64.map
@@ -131,19 +131,16 @@
__sym_ntos;
__sym_ston;
__system_properties_init;
- __system_property_add; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_area__; # var
__system_property_area_init; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_area_serial; # introduced=23
__system_property_find;
- __system_property_find_nth;
__system_property_foreach; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_get;
__system_property_read;
__system_property_serial; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_set; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
__system_property_set_filename; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
- __system_property_update; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_wait_any; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__umask_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
__vsnprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
@@ -1252,8 +1249,15 @@
gMallocLeakZygoteChild;
} LIBC_O;
+LIBC_DEPRECATED {
+ global:
+ __system_property_find_nth;
+};
+
LIBC_PLATFORM {
global:
+ __system_property_add;
+ __system_property_update;
android_net_res_stats_get_info_for_net;
android_net_res_stats_aggregate;
android_net_res_stats_get_usable_servers;
diff --git a/libc/libc.x86.map b/libc/libc.x86.map
index dfa839e..51b222d 100644
--- a/libc/libc.x86.map
+++ b/libc/libc.x86.map
@@ -183,19 +183,16 @@
__sym_ntos;
__sym_ston;
__system_properties_init;
- __system_property_add; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_area__; # var
__system_property_area_init; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_area_serial; # introduced=23
__system_property_find;
- __system_property_find_nth;
__system_property_foreach; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_get;
__system_property_read;
__system_property_serial; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_set; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
__system_property_set_filename; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
- __system_property_update; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_wait_any; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__timer_create; # arm x86 mips
__timer_delete; # arm x86 mips
@@ -1375,8 +1372,15 @@
wcswcs; # arm x86 mips
} LIBC_O;
+LIBC_DEPRECATED {
+ global:
+ __system_property_find_nth;
+};
+
LIBC_PLATFORM {
global:
+ __system_property_add;
+ __system_property_update;
android_net_res_stats_get_info_for_net;
android_net_res_stats_aggregate;
android_net_res_stats_get_usable_servers;
diff --git a/libc/libc.x86_64.map b/libc/libc.x86_64.map
index 179d8bf..a696c41 100644
--- a/libc/libc.x86_64.map
+++ b/libc/libc.x86_64.map
@@ -131,19 +131,16 @@
__sym_ntos;
__sym_ston;
__system_properties_init;
- __system_property_add; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_area__; # var
__system_property_area_init; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_area_serial; # introduced=23
__system_property_find;
- __system_property_find_nth;
__system_property_foreach; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_get;
__system_property_read;
__system_property_serial; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_set; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
__system_property_set_filename; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
- __system_property_update; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__system_property_wait_any; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
__umask_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
__vsnprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
@@ -1252,8 +1249,15 @@
gMallocLeakZygoteChild;
} LIBC_O;
+LIBC_DEPRECATED {
+ global:
+ __system_property_find_nth;
+};
+
LIBC_PLATFORM {
global:
+ __system_property_add;
+ __system_property_update;
android_net_res_stats_get_info_for_net;
android_net_res_stats_aggregate;
android_net_res_stats_get_usable_servers;
diff --git a/tests/gtest_main.cpp b/tests/gtest_main.cpp
index f0dac7c..b9ee585 100644
--- a/tests/gtest_main.cpp
+++ b/tests/gtest_main.cpp
@@ -170,6 +170,9 @@
void SetResult(TestResult result) { result_ = result; }
TestResult GetResult() const { return result_; }
+ TestResult GetExpectedResult() const {
+ return GetName().find("xfail_") == 0 ? TEST_FAILED : TEST_SUCCESS;
+ }
void SetTestTime(int64_t elapsed_time_ns) { elapsed_time_ns_ = elapsed_time_ns; }
@@ -224,6 +227,15 @@
return test_list_[test_id].GetResult();
}
+ TestResult GetExpectedTestResult(size_t test_id) const {
+ VerifyTestId(test_id);
+ return test_list_[test_id].GetExpectedResult();
+ }
+
+ bool GetTestSuccess(size_t test_id) const {
+ return GetTestResult(test_id) == GetExpectedTestResult(test_id);
+ }
+
void SetTestTime(size_t test_id, int64_t elapsed_time_ns) {
VerifyTestId(test_id);
test_list_[test_id].SetTestTime(elapsed_time_ns);
@@ -356,7 +368,7 @@
printf("%s", test_output.c_str());
TestResult result = testcase.GetTestResult(test_id);
- if (result == TEST_SUCCESS) {
+ if (result == testcase.GetExpectedTestResult(test_id)) {
ColoredPrintf(COLOR_GREEN, "[ OK ] ");
} else {
ColoredPrintf(COLOR_RED, "[ FAILED ] ");
@@ -373,10 +385,19 @@
static void OnTestEndPrint(const TestCase& testcase, size_t test_id) {
TestResult result = testcase.GetTestResult(test_id);
+ TestResult expected = testcase.GetExpectedTestResult(test_id);
if (result == TEST_SUCCESS) {
- ColoredPrintf(COLOR_GREEN, "[ OK ] ");
+ if (expected == TEST_SUCCESS) {
+ ColoredPrintf(COLOR_GREEN, "[ OK ] ");
+ } else if (expected == TEST_FAILED) {
+ ColoredPrintf(COLOR_RED, "[ XPASS ] ");
+ }
} else if (result == TEST_FAILED) {
- ColoredPrintf(COLOR_RED, "[ FAILED ] ");
+ if (expected == TEST_SUCCESS) {
+ ColoredPrintf(COLOR_RED, "[ FAILED ] ");
+ } else if (expected == TEST_FAILED) {
+ ColoredPrintf(COLOR_YELLOW, "[ XFAIL ] ");
+ }
} else if (result == TEST_TIMEOUT) {
ColoredPrintf(COLOR_RED, "[ TIMEOUT ] ");
}
@@ -398,6 +419,7 @@
int64_t elapsed_time_ns) {
std::vector<std::string> fail_test_name_list;
+ std::vector<std::string> xpass_test_name_list;
std::vector<std::pair<std::string, int64_t>> timeout_test_list;
// For tests that were slow but didn't time out.
@@ -405,18 +427,28 @@
size_t testcase_count = testcase_list.size();
size_t test_count = 0;
size_t success_test_count = 0;
+ size_t expected_failure_count = 0;
for (const auto& testcase : testcase_list) {
test_count += testcase.TestCount();
for (size_t i = 0; i < testcase.TestCount(); ++i) {
TestResult result = testcase.GetTestResult(i);
- if (result == TEST_SUCCESS) {
- ++success_test_count;
- } else if (result == TEST_FAILED) {
- fail_test_name_list.push_back(testcase.GetTestName(i));
- } else if (result == TEST_TIMEOUT) {
- timeout_test_list.push_back(std::make_pair(testcase.GetTestName(i),
- testcase.GetTestTime(i)));
+ TestResult expected = testcase.GetExpectedTestResult(i);
+ if (result == TEST_TIMEOUT) {
+ timeout_test_list.push_back(
+ std::make_pair(testcase.GetTestName(i), testcase.GetTestTime(i)));
+ } else if (result == expected) {
+ if (result == TEST_SUCCESS) {
+ ++success_test_count;
+ } else {
+ ++expected_failure_count;
+ }
+ } else {
+ if (result == TEST_FAILED) {
+ fail_test_name_list.push_back(testcase.GetTestName(i));
+ } else {
+ xpass_test_name_list.push_back(testcase.GetTestName(i));
+ }
}
if (result != TEST_TIMEOUT &&
testcase.GetTestTime(i) / 1000000 >= GetSlowThresholdMs(testcase.GetTestName(i))) {
@@ -435,7 +467,12 @@
}
printf("\n");
ColoredPrintf(COLOR_GREEN, "[ PASS ] ");
- printf("%zu %s.\n", success_test_count, (success_test_count == 1) ? "test" : "tests");
+ printf("%zu %s.", success_test_count, (success_test_count == 1) ? "test" : "tests");
+ if (expected_failure_count > 0) {
+ printf(" (%zu expected failure%s)", expected_failure_count,
+ (expected_failure_count == 1) ? "" : "s");
+ }
+ printf("\n");
// Print tests that timed out.
size_t timeout_test_count = timeout_test_list.size();
@@ -472,7 +509,18 @@
}
}
- if (timeout_test_count > 0 || slow_test_count > 0 || fail_test_count > 0) {
+ // Print tests that should have failed.
+ size_t xpass_test_count = xpass_test_name_list.size();
+ if (xpass_test_count > 0) {
+ ColoredPrintf(COLOR_RED, "[ XPASS ] ");
+ printf("%zu %s, listed below:\n", xpass_test_count, (xpass_test_count == 1) ? "test" : "tests");
+ for (const auto& name : xpass_test_name_list) {
+ ColoredPrintf(COLOR_RED, "[ XPASS ] ");
+ printf("%s\n", name.c_str());
+ }
+ }
+
+ if (timeout_test_count > 0 || slow_test_count > 0 || fail_test_count > 0 || xpass_test_count > 0) {
printf("\n");
}
@@ -485,6 +533,10 @@
if (fail_test_count > 0) {
printf("%2zu FAILED %s\n", fail_test_count, (fail_test_count == 1) ? "TEST" : "TESTS");
}
+ if (xpass_test_count > 0) {
+ printf("%2zu SHOULD HAVE FAILED %s\n", xpass_test_count, (xpass_test_count == 1) ? "TEST" : "TESTS");
+ }
+
fflush(stdout);
}
@@ -540,7 +592,7 @@
auto& testcase = testcase_list[i];
total_test_count += testcase.TestCount();
for (size_t j = 0; j < testcase.TestCount(); ++j) {
- if (testcase.GetTestResult(j) != TEST_SUCCESS) {
+ if (!testcase.GetTestSuccess(j)) {
++failed_count_list[i];
}
elapsed_time_list[i] += testcase.GetTestTime(j);
@@ -568,7 +620,7 @@
fprintf(fp, " <testcase name=\"%s\" status=\"run\" time=\"%.3lf\" classname=\"%s\"",
testcase.GetTest(j).GetName().c_str(), testcase.GetTestTime(j) / 1e9,
testcase.GetName().c_str());
- if (testcase.GetTestResult(j) == TEST_SUCCESS) {
+ if (!testcase.GetTestSuccess(j)) {
fputs(" />\n", fp);
} else {
fputs(">\n", fp);
@@ -927,7 +979,7 @@
if (++finished_test_count_list[testcase_id] == testcase.TestCount()) {
++finished_testcase_count;
}
- if (testcase.GetTestResult(test_id) != TEST_SUCCESS) {
+ if (!testcase.GetTestSuccess(test_id)) {
all_tests_passed = false;
}
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index 63da9e0..da70d21 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -31,6 +31,7 @@
#include "BionicDeathTest.h"
#include "TemporaryFile.h"
+#include "utils.h"
#if defined(NOFORTIFY)
#define STDIO_TEST stdio_nofortify
@@ -47,6 +48,7 @@
rewind(fp);
char line[1024];
+ memset(line, 0xff, sizeof(line));
ASSERT_EQ(line, fgets(line, sizeof(line), fp));
ASSERT_STREQ(expected, line);
@@ -938,7 +940,7 @@
fclose(fp);
}
-TEST(STDIO_TEST, fmemopen_NULL) {
+TEST(STDIO_TEST, KNOWN_FAILURE_ON_BIONIC(fmemopen_NULL)) {
FILE* fp = fmemopen(nullptr, 128, "r+");
ASSERT_NE(EOF, fputs("xyz\n", fp));
diff --git a/tests/system_properties_test.cpp b/tests/system_properties_test.cpp
index 09eac3f..70482f0 100644
--- a/tests/system_properties_test.cpp
+++ b/tests/system_properties_test.cpp
@@ -244,16 +244,10 @@
ASSERT_EQ(0, __system_property_add("other_property", 14, "value2", 6));
ASSERT_EQ(0, __system_property_add("property_other", 14, "value3", 6));
- ASSERT_NE((const prop_info *)NULL, __system_property_find_nth(0));
- ASSERT_NE((const prop_info *)NULL, __system_property_find_nth(1));
- ASSERT_NE((const prop_info *)NULL, __system_property_find_nth(2));
-
- ASSERT_EQ((const prop_info *)NULL, __system_property_find_nth(3));
- ASSERT_EQ((const prop_info *)NULL, __system_property_find_nth(4));
- ASSERT_EQ((const prop_info *)NULL, __system_property_find_nth(5));
- ASSERT_EQ((const prop_info *)NULL, __system_property_find_nth(100));
- ASSERT_EQ((const prop_info *)NULL, __system_property_find_nth(200));
- ASSERT_EQ((const prop_info *)NULL, __system_property_find_nth(247));
+ // This method is no longer supported and should result in abort
+ ASSERT_EXIT(__system_property_find_nth(0), testing::KilledBySignal(SIGABRT),
+ "__system_property_find_nth is not supported since Android O,"
+ " please use __system_property_foreach instead.");
#else // __BIONIC__
GTEST_LOG_(INFO) << "This test does nothing.\n";
#endif // __BIONIC__
diff --git a/tests/utils.h b/tests/utils.h
index 4c3aef4..79eed10 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -32,6 +32,12 @@
#include "private/ScopeGuard.h"
+#if defined(__BIONIC__)
+#define KNOWN_FAILURE_ON_BIONIC(x) xfail_ ## x
+#else
+#define KNOWN_FAILURE_ON_BIONIC(x) x
+#endif
+
#if defined(__linux__)
struct map_record {