summaryrefslogtreecommitdiff
path: root/hints
diff options
context:
space:
mode:
authorRichard Leach <rich+perl@hyphen-dash-hyphen.info>2019-05-19 03:27:56 +0000
committerKarl Williamson <khw@cpan.org>2019-06-25 12:40:06 -0600
commitf1d63d3c9399eb3b51a808574f055fa1b2b57979 (patch)
treedd09bdffc1f4683e4f220f9bbcbfd76006a2148b /hints
parent78342678c3d43495ec0526969486d748b07f0525 (diff)
downloadperl-f1d63d3c9399eb3b51a808574f055fa1b2b57979.tar.gz
Tests for Android stub functions updated for Oreo
Diffstat (limited to 'hints')
-rw-r--r--hints/linux-android.sh56
1 files changed, 47 insertions, 9 deletions
diff --git a/hints/linux-android.sh b/hints/linux-android.sh
index 9f7196fc43..cd22876662 100644
--- a/hints/linux-android.sh
+++ b/hints/linux-android.sh
@@ -43,27 +43,37 @@ libswanted="$libswanted m log"
# https://code.google.com/p/android-source-browsing/source/browse/libc/netbsd/net/getservent_r.c?repo=platform--bionic&r=ca6fe7bebe3cc6ed7e2db5a3ede2de0fcddf411d#95
d_getservent_r='undef'
-# Bionic defines several stubs that just warn and return NULL
+# Bionic defines several stubs that warn (in older releases) and return NULL
# https://gitorious.org/0xdroid/bionic/blobs/70b2ef0ec89a9c9d4c2d4bcab728a0e72bafb18e/libc/bionic/stubs.c
# https://android.googlesource.com/platform/bionic/+/master/libc/bionic/stubs.cpp
-# If they warn with 'FIX' or 'Android', assume they are the stubs
-# we want to avoid.
+# These tests originally looked for 'FIX' or 'Android' warnings, as they
+# indicated stubs to avoid. At some point, Android stopped emitting
+# those warnings; the tests were adapted to check function return values
+# and hopefully now detect stubs on both older and newer Androids.
# These are all stubs as well, but the core doesn't use them:
# getusershell setusershell endusershell
# This script UU/archname.cbu will get 'called-back' by Configure.
$cat > UU/archname.cbu <<'EOCBU'
-# egrep pattern to detect a stub warning on Android.
+# original egrep pattern to detect a stub warning on Android.
# Right now we're checking for:
# Android 2.x: FIX ME! implement FUNC
# Android 4.x: FUNC is not implemented on Android
+# Android 8.x: <no warnings; tests now printf a compatible warning>
android_stub='FIX|Android'
$cat > try.c << 'EOM'
#include <netdb.h>
-int main() { (void) getnetbyname("foo"); return(0); }
+#include <stdio.h>
+int main() {
+ struct netent* test = getnetbyname("loopback");
+ if (test == NULL) {
+ printf("getnetbyname is still a stub function on Android");
+ }
+ return(0);
+}
EOM
$cc $ccflags try.c -o try
android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
@@ -73,7 +83,14 @@ fi
$cat > try.c << 'EOM'
#include <netdb.h>
-int main() { (void) getnetbyaddr((uint32_t)1, AF_INET); return(0); }
+#include <stdio.h>
+int main() {
+ struct netent* test = getnetbyaddr(127, AF_INET);
+ if (test == NULL) {
+ printf("getnetbyaddr is still a stub function on Android");
+ }
+ return(0);
+}
EOM
$cc $ccflags try.c -o try
android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
@@ -95,7 +112,14 @@ fi
$cat > try.c << 'EOM'
#include <netdb.h>
-int main() { (void) getprotobyname("foo"); return(0); }
+#include <stdio.h>
+int main() {
+ struct protoent* test = getprotobyname("tcp");
+ if (test == NULL) {
+ printf("getprotobyname is still a stub function on Android");
+ }
+ return(0);
+}
EOM
$cc $ccflags try.c -o try
android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
@@ -105,7 +129,14 @@ fi
$cat > try.c << 'EOM'
#include <netdb.h>
-int main() { (void) getprotobynumber(1); return(0); }
+#include <stdio.h>
+int main() {
+ struct protoent* test = getprotobynumber(1);
+ if (test == NULL) {
+ printf("getprotobynumber is still a stub function on Android");
+ }
+ return(0);
+}
EOM
$cc $ccflags try.c -o try
android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
@@ -126,7 +157,14 @@ fi
$cat > try.c << 'EOM'
#include <unistd.h>
-int main() { (void) ttyname(STDIN_FILENO); return(0); }
+#include <stdio.h>
+int main() {
+ char *tty = ttyname(STDIN_FILENO);
+ if (tty == NULL) {
+ printf("ttyname is still a stub function on Android");
+ }
+ return(0);
+}
EOM
$cc $ccflags try.c -o try
android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`