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/stdio_test.cpp b/tests/stdio_test.cpp
index 39f9b0f..70a71fb 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -75,7 +75,7 @@
   // It should set the end-of-file indicator for the stream, though.
   errno = 0;
   ASSERT_EQ(getdelim(&word_read, &allocated_length, ' ', fp), -1);
-  ASSERT_EQ(errno, 0);
+  ASSERT_EQ(0, errno);
   ASSERT_TRUE(feof(fp));
 
   free(word_read);
@@ -91,18 +91,18 @@
   // The first argument can't be NULL.
   errno = 0;
   ASSERT_EQ(getdelim(NULL, &buffer_length, ' ', fp), -1);
-  ASSERT_EQ(errno, EINVAL);
+  ASSERT_EQ(EINVAL, errno);
 
   // The second argument can't be NULL.
   errno = 0;
   ASSERT_EQ(getdelim(&buffer, NULL, ' ', fp), -1);
-  ASSERT_EQ(errno, EINVAL);
+  ASSERT_EQ(EINVAL, errno);
 
   // The stream can't be closed.
   fclose(fp);
   errno = 0;
   ASSERT_EQ(getdelim(&buffer, &buffer_length, ' ', fp), -1);
-  ASSERT_EQ(errno, EBADF);
+  ASSERT_EQ(EBADF, errno);
 }
 
 TEST(stdio, getline) {
@@ -140,7 +140,7 @@
   // It should set the end-of-file indicator for the stream, though.
   errno = 0;
   ASSERT_EQ(getline(&line_read, &allocated_length, fp), -1);
-  ASSERT_EQ(errno, 0);
+  ASSERT_EQ(0, errno);
   ASSERT_TRUE(feof(fp));
 
   free(line_read);
@@ -156,16 +156,16 @@
   // The first argument can't be NULL.
   errno = 0;
   ASSERT_EQ(getline(NULL, &buffer_length, fp), -1);
-  ASSERT_EQ(errno, EINVAL);
+  ASSERT_EQ(EINVAL, errno);
 
   // The second argument can't be NULL.
   errno = 0;
   ASSERT_EQ(getline(&buffer, NULL, fp), -1);
-  ASSERT_EQ(errno, EINVAL);
+  ASSERT_EQ(EINVAL, errno);
 
   // The stream can't be closed.
   fclose(fp);
   errno = 0;
   ASSERT_EQ(getline(&buffer, &buffer_length, fp), -1);
-  ASSERT_EQ(errno, EBADF);
+  ASSERT_EQ(EBADF, errno);
 }