Fix __pthread_clone on ARM to set errno on failure.

MIPS and x86 appear to have been correct already.

(Also fix unit tests that ASSERT_EQ with errno so that the
arguments are in the retarded junit order.)

Bug: 3461078
Change-Id: I2418ea98927b56e15b4ba9cfec97f5e7094c6291
diff --git a/tests/dirent_test.cpp b/tests/dirent_test.cpp
index 8f3c249..48ca819 100644
--- a/tests/dirent_test.cpp
+++ b/tests/dirent_test.cpp
@@ -66,12 +66,12 @@
 
 TEST(dirent, fdopendir_invalid) {
   ASSERT_TRUE(fdopendir(-1) == NULL);
-  ASSERT_EQ(errno, EBADF);
+  ASSERT_EQ(EBADF, errno);
 
   int fd = open("/dev/null", O_RDONLY);
   ASSERT_NE(fd, -1);
   ASSERT_TRUE(fdopendir(fd) == NULL);
-  ASSERT_EQ(errno, ENOTDIR);
+  ASSERT_EQ(ENOTDIR, errno);
   close(fd);
 }
 
@@ -85,15 +85,15 @@
 
   // fdopendir(3) took ownership, so closedir(3) closed our fd.
   ASSERT_EQ(close(fd), -1);
-  ASSERT_EQ(errno, EBADF);
+  ASSERT_EQ(EBADF, errno);
 }
 
 TEST(dirent, opendir_invalid) {
   ASSERT_TRUE(opendir("/does/not/exist") == NULL);
-  ASSERT_EQ(errno, ENOENT);
+  ASSERT_EQ(ENOENT, errno);
 
   ASSERT_TRUE(opendir("/dev/null") == NULL);
-  ASSERT_EQ(errno, ENOTDIR);
+  ASSERT_EQ(ENOTDIR, errno);
 }
 
 TEST(dirent, opendir) {
@@ -107,7 +107,7 @@
 TEST(dirent, closedir_invalid) {
   DIR* d = NULL;
   ASSERT_EQ(closedir(d), -1);
-  ASSERT_EQ(errno, EINVAL);
+  ASSERT_EQ(EINVAL, errno);
 }
 
 TEST(dirent, closedir) {
@@ -127,7 +127,7 @@
   }
   // Reading to the end of the directory is not an error.
   // readdir(3) returns NULL, but leaves errno as 0.
-  ASSERT_EQ(errno, 0);
+  ASSERT_EQ(0, errno);
   ASSERT_EQ(closedir(d), 0);
 
   CheckProcSelf(name_set);
@@ -145,7 +145,7 @@
   }
   // Reading to the end of the directory is not an error.
   // readdir_r(3) returns NULL, but leaves errno as 0.
-  ASSERT_EQ(errno, 0);
+  ASSERT_EQ(0, errno);
   ASSERT_EQ(closedir(d), 0);
 
   CheckProcSelf(name_set);