Merge "Provide method to dump backtrace heap data."
diff --git a/libc/kernel/tools/cpp.py b/libc/kernel/tools/cpp.py
index bca491b..fff80f6 100644
--- a/libc/kernel/tools/cpp.py
+++ b/libc/kernel/tools/cpp.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
"""A glorified C pre-processor parser."""
import ctypes
diff --git a/libc/tools/check-symbols.py b/libc/tools/check-symbols.py
index a6cf50c..6568917 100755
--- a/libc/tools/check-symbols.py
+++ b/libc/tools/check-symbols.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
import glob
import os
diff --git a/libc/tools/generate-NOTICE.py b/libc/tools/generate-NOTICE.py
index d40891c..e59fc7a 100755
--- a/libc/tools/generate-NOTICE.py
+++ b/libc/tools/generate-NOTICE.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# Run with directory arguments from any directory, with no special setup required.
# Or:
# for i in libc libdl libm linker libstdc++ ; do ./libc/tools/generate-NOTICE.py $i > $i/NOTICE ; done
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index e6240a1..46affb7 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# This tool is used to generate the assembler system call stubs,
# the header files listing all available system calls, and the
diff --git a/libc/tools/genversion-scripts.py b/libc/tools/genversion-scripts.py
index 0a98994..5410580 100755
--- a/libc/tools/genversion-scripts.py
+++ b/libc/tools/genversion-scripts.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# This tool is used to generate the version scripts for libc and libm
# for every architecture.
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp
index 857640a..aaf2c37 100644
--- a/tests/dl_test.cpp
+++ b/tests/dl_test.cpp
@@ -16,6 +16,10 @@
#include <gtest/gtest.h>
+#if defined(__BIONIC__)
+#include <android-base/properties.h>
+#endif
+
#include <dlfcn.h>
#include <libgen.h>
#include <limits.h>
@@ -226,6 +230,12 @@
// This test is only for CTS.
return;
}
+ std::string build_type = android::base::GetProperty("ro.build.type", "user");
+ if (build_type == "userdebug" || build_type == "eng") {
+ // Skip the test for non production devices
+ return;
+ }
+
std::string error_message = "CANNOT LINK EXECUTABLE \"" + get_testlib_root() + "/ld_config_test_helper/ld_config_test_helper\": library \"ld_config_test_helper_lib1.so\" not found\n";
std::string helper = get_testlib_root() +
"/ld_config_test_helper/ld_config_test_helper";
diff --git a/tests/iconv_test.cpp b/tests/iconv_test.cpp
index b197152..768b4fd 100644
--- a/tests/iconv_test.cpp
+++ b/tests/iconv_test.cpp
@@ -427,3 +427,29 @@
TEST(iconv, iconv_EINVAL_utf32le_short) {
Check(EINVAL, "utf32le", "\x24\x00\x00", 3); // Missing final byte.
}
+
+TEST(iconv, iconv_initial_shift_state) {
+ // POSIX: "For state-dependent encodings, the conversion descriptor
+ // cd is placed into its initial shift state by a call for which inbuf
+ // is a null pointer, or for which inbuf points to a null pointer."
+ iconv_t c = iconv_open("utf8", "utf8");
+ char* in = nullptr;
+ size_t in_bytes = 0;
+ wchar_t out_buf[16];
+ size_t out_bytes = sizeof(out_buf);
+ char* out = reinterpret_cast<char*>(out_buf);
+
+ // Points to a null pointer...
+ errno = 0;
+ ASSERT_EQ(static_cast<size_t>(0), iconv(c, &in, &in_bytes, &out, &out_bytes));
+ EXPECT_EQ(0, errno);
+ EXPECT_EQ(sizeof(out_buf), out_bytes);
+
+ // Is a null pointer...
+ errno = 0;
+ ASSERT_EQ(static_cast<size_t>(0), iconv(c, nullptr, &in_bytes, &out, &out_bytes));
+ EXPECT_EQ(0, errno);
+ EXPECT_EQ(sizeof(out_buf), out_bytes);
+
+ EXPECT_EQ(0, iconv_close(c));
+}