summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-12-23 19:37:12 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-12-23 19:37:12 -0800
commitd236fbed3338996fd6ed7791178f5c1972864b50 (patch)
treedcc4c2cc64349ea730fbecbb3861313f44088e1a
parenta2ae08b22f7ffc41f3bef42f2437dc2a2d4f99ed (diff)
downloadtxr-d236fbed3338996fd6ed7791178f5c1972864b50.tar.gz
txr-d236fbed3338996fd6ed7791178f5c1972864b50.tar.bz2
txr-d236fbed3338996fd6ed7791178f5c1972864b50.zip
android: fix socket module, failing tests.
* socket.c: Add missing #include <netinet/in.h>. * tests/017/glob-carray.tl, tests/017/glob-zarray.tl: Use same definition for struct glob as Cygwin. Both are of BSD origin. * tests/017/realpath.tl: Do not test on Android. * tests/common.tl (os-symbol): Detect Android and return :android. (libc): Handle :android.
-rw-r--r--socket.c1
-rw-r--r--tests/017/glob-carray.tl2
-rw-r--r--tests/017/glob-zarray.tl2
-rw-r--r--tests/017/realpath.tl8
-rw-r--r--tests/common.tl20
5 files changed, 18 insertions, 15 deletions
diff --git a/socket.c b/socket.c
index 38cbd7f0..3a28fd3f 100644
--- a/socket.c
+++ b/socket.c
@@ -44,6 +44,7 @@
#elif HAVE_SELECT
#include <sys/select.h>
#endif
+#include <netinet/in.h>
#include "lib.h"
#include "stream.h"
#include "signal.h"
diff --git a/tests/017/glob-carray.tl b/tests/017/glob-carray.tl
index 99660576..7913701b 100644
--- a/tests/017/glob-carray.tl
+++ b/tests/017/glob-carray.tl
@@ -12,7 +12,7 @@
(nil int)
(pathv (carray str))
(nil (array 4 cptr)))))
- ((:cygnal :cygwin)
+ ((:cygnal :cygwin :android)
(deffi-type glob-t (struct glob-t
(pathc size-t)
(nil size-t)
diff --git a/tests/017/glob-zarray.tl b/tests/017/glob-zarray.tl
index b095e45e..e3f6d08b 100644
--- a/tests/017/glob-zarray.tl
+++ b/tests/017/glob-zarray.tl
@@ -12,7 +12,7 @@
(nil int)
(pathv (ptr-out (zarray str)))
(nil (array 4 cptr)))))
- ((:cygnal :cygwin)
+ ((:cygnal :cygwin :android)
(deffi-type glob-t (struct glob-t
(pathc size-t)
(nil size-t)
diff --git a/tests/017/realpath.tl b/tests/017/realpath.tl
index d920825f..5471a1c8 100644
--- a/tests/017/realpath.tl
+++ b/tests/017/realpath.tl
@@ -1,12 +1,12 @@
(load "../common")
+(when (memq (os-symbol) '(:cygwin :solaris :android))
+ (put-string (file-get-string "tests/017/realpath.expected"))
+ (exit 0))
+
(with-dyn-lib (libc)
(deffi realpath-null "realpath" str-d (str str))
(deffi realpath-buf "realpath" str-d (str (ptr-in-d (zarray 8192 char)))))
-(when (memq (os-symbol) '(:cygwin :solaris))
- (put-string (file-get-string "tests/017/realpath.expected"))
- (exit 0))
-
(prinl (realpath-null "/usr/bin" nil))
(prinl (realpath-buf "/usr/bin" (copy "")))
diff --git a/tests/common.tl b/tests/common.tl
index 3eef8d31..cdfc6c6a 100644
--- a/tests/common.tl
+++ b/tests/common.tl
@@ -24,16 +24,18 @@
^(progn ,*(mapcar (op cons 'test) (tuples 2 pairs))))
(defun os-symbol ()
- (let ((u (uname)))
- [(orf (iff (f^ #/Linux/) (ret :linux))
- (iff (f^ #/SunOS/) (ret :solaris))
- (iff (f^ #/CYGWIN/) (ret :cygwin))
- (iff (f^ #/CYGNAL/) (ret :cygnal))
- (iff (f^ #/Darwin/) (ret :macos))
- (ret :unknown))
- u.sysname]))
+ (if (ignerr (dlsym (dlopen "libandroid.so") "AAsset_close"))
+ :android
+ (let ((u (uname)))
+ [(orf (iff (f^ #/Linux/) (ret :linux))
+ (iff (f^ #/SunOS/) (ret :solaris))
+ (iff (f^ #/CYGWIN/) (ret :cygwin))
+ (iff (f^ #/CYGNAL/) (ret :cygnal))
+ (iff (f^ #/Darwin/) (ret :macos))
+ (ret :unknown))
+ u.sysname])))
(defun libc ()
(caseql (os-symbol)
- ((:linux :solaris :macos) (dlopen nil))
+ ((:linux :solaris :macos :android) (dlopen nil))
((:cygwin) (dlopen "cygwin1.dll"))))