blob: 050f5a766265d1a62c9a47683d1c99020f16f8d4 [file] [log] [blame]
Elliott Hughes774c7f52012-10-01 13:11:03 -07001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <gtest/gtest.h>
Yabin Cui9df70402014-11-05 18:01:01 -080018#include "BionicDeathTest.h"
Calin Juravlefe317a32014-02-21 15:11:03 +000019#include "TemporaryFile.h"
Elliott Hughes774c7f52012-10-01 13:11:03 -070020
Elliott Hughesb16b7222013-02-04 13:18:00 -080021#include <errno.h>
Elliott Hughesf0777842013-03-01 16:59:46 -080022#include <libgen.h>
23#include <limits.h>
Elliott Hughes877ec6d2013-11-15 17:40:18 -080024#include <pthread.h>
Elliott Hughesb16b7222013-02-04 13:18:00 -080025#include <stdint.h>
Elliott Hughes774c7f52012-10-01 13:11:03 -070026#include <stdlib.h>
Calin Juravlefe317a32014-02-21 15:11:03 +000027#include <fcntl.h>
Elliott Hughes40488562014-03-12 13:50:38 -070028#include <sys/types.h>
29#include <sys/wait.h>
Elliott Hughes774c7f52012-10-01 13:11:03 -070030
Elliott Hughes274afe82014-11-06 12:40:08 -080031// The random number generator tests all set the seed, get four values, reset the seed and check
32// that they get the first two values repeated, and then reset the seed and check two more values
33// to rule out the possibility that we're just going round a cycle of four values.
34// TODO: factor this out.
35
Elliott Hughes774c7f52012-10-01 13:11:03 -070036TEST(stdlib, drand48) {
37 srand48(0x01020304);
38 EXPECT_DOUBLE_EQ(0.65619299195623526, drand48());
39 EXPECT_DOUBLE_EQ(0.18522597229772941, drand48());
40 EXPECT_DOUBLE_EQ(0.42015087072844537, drand48());
41 EXPECT_DOUBLE_EQ(0.061637783047395089, drand48());
Elliott Hughes274afe82014-11-06 12:40:08 -080042 srand48(0x01020304);
43 EXPECT_DOUBLE_EQ(0.65619299195623526, drand48());
44 EXPECT_DOUBLE_EQ(0.18522597229772941, drand48());
45 srand48(0x01020304);
46 EXPECT_DOUBLE_EQ(0.65619299195623526, drand48());
47 EXPECT_DOUBLE_EQ(0.18522597229772941, drand48());
48}
49
50TEST(stdlib, erand48) {
51 const unsigned short seed[3] = { 0x330e, 0xabcd, 0x1234 };
52 unsigned short xsubi[3];
53 memcpy(xsubi, seed, sizeof(seed));
54 EXPECT_DOUBLE_EQ(0.39646477376027534, erand48(xsubi));
55 EXPECT_DOUBLE_EQ(0.84048536941142515, erand48(xsubi));
56 EXPECT_DOUBLE_EQ(0.35333609724524351, erand48(xsubi));
57 EXPECT_DOUBLE_EQ(0.44658343479654405, erand48(xsubi));
58 memcpy(xsubi, seed, sizeof(seed));
59 EXPECT_DOUBLE_EQ(0.39646477376027534, erand48(xsubi));
60 EXPECT_DOUBLE_EQ(0.84048536941142515, erand48(xsubi));
61 memcpy(xsubi, seed, sizeof(seed));
62 EXPECT_DOUBLE_EQ(0.39646477376027534, erand48(xsubi));
63 EXPECT_DOUBLE_EQ(0.84048536941142515, erand48(xsubi));
64}
65
66TEST(stdlib, lcong48) {
67 unsigned short p[7] = { 0x0102, 0x0304, 0x0506, 0x0708, 0x090a, 0x0b0c, 0x0d0e };
68 lcong48(p);
69 EXPECT_EQ(1531389981, lrand48());
70 EXPECT_EQ(1598801533, lrand48());
71 EXPECT_EQ(2080534853, lrand48());
72 EXPECT_EQ(1102488897, lrand48());
73 lcong48(p);
74 EXPECT_EQ(1531389981, lrand48());
75 EXPECT_EQ(1598801533, lrand48());
76 lcong48(p);
77 EXPECT_EQ(1531389981, lrand48());
78 EXPECT_EQ(1598801533, lrand48());
Elliott Hughes774c7f52012-10-01 13:11:03 -070079}
80
Elliott Hughesa0beeea2014-06-12 11:48:04 -070081TEST(stdlib, lrand48) {
Elliott Hughes774c7f52012-10-01 13:11:03 -070082 srand48(0x01020304);
83 EXPECT_EQ(1409163720, lrand48());
84 EXPECT_EQ(397769746, lrand48());
85 EXPECT_EQ(902267124, lrand48());
86 EXPECT_EQ(132366131, lrand48());
Elliott Hughes274afe82014-11-06 12:40:08 -080087 srand48(0x01020304);
88 EXPECT_EQ(1409163720, lrand48());
89 EXPECT_EQ(397769746, lrand48());
90 srand48(0x01020304);
91 EXPECT_EQ(1409163720, lrand48());
92 EXPECT_EQ(397769746, lrand48());
Elliott Hughesa0beeea2014-06-12 11:48:04 -070093}
Elliott Hughes774c7f52012-10-01 13:11:03 -070094
Elliott Hughesa0beeea2014-06-12 11:48:04 -070095TEST(stdlib, random) {
Elliott Hughes774c7f52012-10-01 13:11:03 -070096 srandom(0x01020304);
Elliott Hughesa0beeea2014-06-12 11:48:04 -070097 EXPECT_EQ(55436735, random());
98 EXPECT_EQ(1399865117, random());
99 EXPECT_EQ(2032643283, random());
100 EXPECT_EQ(571329216, random());
Elliott Hughes274afe82014-11-06 12:40:08 -0800101 srandom(0x01020304);
102 EXPECT_EQ(55436735, random());
103 EXPECT_EQ(1399865117, random());
104 srandom(0x01020304);
105 EXPECT_EQ(55436735, random());
106 EXPECT_EQ(1399865117, random());
Elliott Hughesa0beeea2014-06-12 11:48:04 -0700107}
Elliott Hughes774c7f52012-10-01 13:11:03 -0700108
Elliott Hughesa0beeea2014-06-12 11:48:04 -0700109TEST(stdlib, rand) {
Elliott Hughes774c7f52012-10-01 13:11:03 -0700110 srand(0x01020304);
Elliott Hughesa0beeea2014-06-12 11:48:04 -0700111 EXPECT_EQ(55436735, rand());
112 EXPECT_EQ(1399865117, rand());
113 EXPECT_EQ(2032643283, rand());
114 EXPECT_EQ(571329216, rand());
Elliott Hughes274afe82014-11-06 12:40:08 -0800115 srand(0x01020304);
116 EXPECT_EQ(55436735, rand());
117 EXPECT_EQ(1399865117, rand());
118 srand(0x01020304);
119 EXPECT_EQ(55436735, rand());
120 EXPECT_EQ(1399865117, rand());
Elliott Hughes774c7f52012-10-01 13:11:03 -0700121}
122
123TEST(stdlib, mrand48) {
124 srand48(0x01020304);
125 EXPECT_EQ(-1476639856, mrand48());
126 EXPECT_EQ(795539493, mrand48());
127 EXPECT_EQ(1804534249, mrand48());
128 EXPECT_EQ(264732262, mrand48());
Elliott Hughes274afe82014-11-06 12:40:08 -0800129 srand48(0x01020304);
130 EXPECT_EQ(-1476639856, mrand48());
131 EXPECT_EQ(795539493, mrand48());
132 srand48(0x01020304);
133 EXPECT_EQ(-1476639856, mrand48());
134 EXPECT_EQ(795539493, mrand48());
Elliott Hughes774c7f52012-10-01 13:11:03 -0700135}
Elliott Hughesb16b7222013-02-04 13:18:00 -0800136
137TEST(stdlib, posix_memalign) {
138 void* p;
139
140 ASSERT_EQ(0, posix_memalign(&p, 512, 128));
141 ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(p) % 512);
142 free(p);
143
144 // Can't align to a non-power of 2.
145 ASSERT_EQ(EINVAL, posix_memalign(&p, 81, 128));
146}
Elliott Hughesf0777842013-03-01 16:59:46 -0800147
148TEST(stdlib, realpath__NULL_filename) {
149 errno = 0;
150 char* p = realpath(NULL, NULL);
151 ASSERT_TRUE(p == NULL);
152 ASSERT_EQ(EINVAL, errno);
153}
154
155TEST(stdlib, realpath__empty_filename) {
156 errno = 0;
157 char* p = realpath("", NULL);
158 ASSERT_TRUE(p == NULL);
159 ASSERT_EQ(ENOENT, errno);
160}
161
162TEST(stdlib, realpath__ENOENT) {
163 errno = 0;
164 char* p = realpath("/this/directory/path/almost/certainly/does/not/exist", NULL);
165 ASSERT_TRUE(p == NULL);
166 ASSERT_EQ(ENOENT, errno);
167}
168
Elliott Hughes31e072f2014-09-30 16:15:42 -0700169TEST(stdlib, realpath__component_after_non_directory) {
170 errno = 0;
171 char* p = realpath("/dev/null/.", NULL);
172 ASSERT_TRUE(p == NULL);
173 ASSERT_EQ(ENOTDIR, errno);
174
175 errno = 0;
176 p = realpath("/dev/null/..", NULL);
177 ASSERT_TRUE(p == NULL);
178 ASSERT_EQ(ENOTDIR, errno);
179}
180
Elliott Hughesf0777842013-03-01 16:59:46 -0800181TEST(stdlib, realpath) {
182 // Get the name of this executable.
183 char executable_path[PATH_MAX];
184 int rc = readlink("/proc/self/exe", executable_path, sizeof(executable_path));
185 ASSERT_NE(rc, -1);
186 executable_path[rc] = '\0';
187
188 char buf[PATH_MAX + 1];
189 char* p = realpath("/proc/self/exe", buf);
190 ASSERT_STREQ(executable_path, p);
191
192 p = realpath("/proc/self/exe", NULL);
193 ASSERT_STREQ(executable_path, p);
194 free(p);
195}
Elliott Hughes0b25f632013-04-11 18:08:34 -0700196
197TEST(stdlib, qsort) {
198 struct s {
199 char name[16];
200 static int comparator(const void* lhs, const void* rhs) {
201 return strcmp(reinterpret_cast<const s*>(lhs)->name, reinterpret_cast<const s*>(rhs)->name);
202 }
203 };
204 s entries[3];
205 strcpy(entries[0].name, "charlie");
206 strcpy(entries[1].name, "bravo");
207 strcpy(entries[2].name, "alpha");
208
209 qsort(entries, 3, sizeof(s), s::comparator);
210 ASSERT_STREQ("alpha", entries[0].name);
211 ASSERT_STREQ("bravo", entries[1].name);
212 ASSERT_STREQ("charlie", entries[2].name);
213
214 qsort(entries, 3, sizeof(s), s::comparator);
215 ASSERT_STREQ("alpha", entries[0].name);
216 ASSERT_STREQ("bravo", entries[1].name);
217 ASSERT_STREQ("charlie", entries[2].name);
218}
Elliott Hughes877ec6d2013-11-15 17:40:18 -0800219
220static void* TestBug57421_child(void* arg) {
221 pthread_t main_thread = reinterpret_cast<pthread_t>(arg);
222 pthread_join(main_thread, NULL);
223 char* value = getenv("ENVIRONMENT_VARIABLE");
224 if (value == NULL) {
225 setenv("ENVIRONMENT_VARIABLE", "value", 1);
226 }
227 return NULL;
228}
229
230static void TestBug57421_main() {
231 pthread_t t;
232 ASSERT_EQ(0, pthread_create(&t, NULL, TestBug57421_child, reinterpret_cast<void*>(pthread_self())));
233 pthread_exit(NULL);
234}
235
236// Even though this isn't really a death test, we have to say "DeathTest" here so gtest knows to
237// run this test (which exits normally) in its own process.
Yabin Cui9df70402014-11-05 18:01:01 -0800238
239class stdlib_DeathTest : public BionicDeathTest {};
240
241TEST_F(stdlib_DeathTest, getenv_after_main_thread_exits) {
Elliott Hughes877ec6d2013-11-15 17:40:18 -0800242 // https://code.google.com/p/android/issues/detail?id=57421
Elliott Hughes877ec6d2013-11-15 17:40:18 -0800243 ASSERT_EXIT(TestBug57421_main(), ::testing::ExitedWithCode(0), "");
244}
Calin Juravlefe317a32014-02-21 15:11:03 +0000245
Elliott Hughes31165ed2014-09-23 17:34:29 -0700246TEST(stdlib, mkostemp64) {
247 TemporaryFile tf([](char* path) { return mkostemp64(path, O_CLOEXEC); });
248 int flags = fcntl(tf.fd, F_GETFD);
249 ASSERT_TRUE(flags != -1);
250 ASSERT_EQ(FD_CLOEXEC, flags & FD_CLOEXEC);
251}
252
253TEST(stdlib, mkostemp) {
254 TemporaryFile tf([](char* path) { return mkostemp(path, O_CLOEXEC); });
255 int flags = fcntl(tf.fd, F_GETFD);
256 ASSERT_TRUE(flags != -1);
257 ASSERT_EQ(FD_CLOEXEC, flags & FD_CLOEXEC);
258}
259
260TEST(stdlib, mkstemp64) {
261 TemporaryFile tf(mkstemp64);
262 struct stat64 sb;
263 ASSERT_EQ(0, fstat64(tf.fd, &sb));
264 ASSERT_EQ(O_LARGEFILE, fcntl(tf.fd, F_GETFL) & O_LARGEFILE);
265}
266
Calin Juravlefe317a32014-02-21 15:11:03 +0000267TEST(stdlib, mkstemp) {
268 TemporaryFile tf;
269 struct stat sb;
270 ASSERT_EQ(0, fstat(tf.fd, &sb));
271}
272
Elliott Hughes3cdf5732014-03-11 12:54:44 -0700273TEST(stdlib, system) {
274 int status;
275
276 status = system("exit 0");
277 ASSERT_TRUE(WIFEXITED(status));
278 ASSERT_EQ(0, WEXITSTATUS(status));
279
280 status = system("exit 1");
281 ASSERT_TRUE(WIFEXITED(status));
282 ASSERT_EQ(1, WEXITSTATUS(status));
283}
Elliott Hughes5a817382014-03-12 16:12:57 -0700284
285TEST(stdlib, atof) {
Christopher Ferrisf171b342014-03-17 16:40:26 -0700286 ASSERT_DOUBLE_EQ(1.23, atof("1.23"));
Elliott Hughes5a817382014-03-12 16:12:57 -0700287}
288
289TEST(stdlib, strtod) {
Christopher Ferrisf171b342014-03-17 16:40:26 -0700290 ASSERT_DOUBLE_EQ(1.23, strtod("1.23", NULL));
Elliott Hughes5a817382014-03-12 16:12:57 -0700291}
292
293TEST(stdlib, strtof) {
Christopher Ferrisf171b342014-03-17 16:40:26 -0700294 ASSERT_FLOAT_EQ(1.23, strtof("1.23", NULL));
Elliott Hughes5a817382014-03-12 16:12:57 -0700295}
296
297TEST(stdlib, strtold) {
Christopher Ferrisf171b342014-03-17 16:40:26 -0700298 ASSERT_DOUBLE_EQ(1.23, strtold("1.23", NULL));
Elliott Hughes5a817382014-03-12 16:12:57 -0700299}
Elliott Hughes9f525642014-04-08 17:14:01 -0700300
Elliott Hughes89aaaff2014-10-28 17:54:23 -0700301TEST(stdlib, strtof_2206701) {
302 ASSERT_EQ(0.0f, strtof("7.0064923216240853546186479164495e-46", NULL));
303 ASSERT_EQ(1.4e-45f, strtof("7.0064923216240853546186479164496e-46", NULL));
304}
305
306TEST(stdlib, strtod_largest_subnormal) {
307 // This value has been known to cause javac and java to infinite loop.
308 // http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
309 ASSERT_EQ(2.2250738585072014e-308, strtod("2.2250738585072012e-308", NULL));
310 ASSERT_EQ(2.2250738585072014e-308, strtod("0.00022250738585072012e-304", NULL));
311 ASSERT_EQ(2.2250738585072014e-308, strtod("00000002.2250738585072012e-308", NULL));
312 ASSERT_EQ(2.2250738585072014e-308, strtod("2.225073858507201200000e-308", NULL));
313 ASSERT_EQ(2.2250738585072014e-308, strtod("2.2250738585072012e-00308", NULL));
314 ASSERT_EQ(2.2250738585072014e-308, strtod("2.22507385850720129978001e-308", NULL));
315 ASSERT_EQ(-2.2250738585072014e-308, strtod("-2.2250738585072012e-308", NULL));
316}
317
Dan Albertb8425c52014-04-29 17:49:06 -0700318TEST(stdlib, quick_exit) {
319 pid_t pid = fork();
320 ASSERT_NE(-1, pid) << strerror(errno);
321
322 if (pid == 0) {
323 quick_exit(99);
324 }
325
326 int status;
327 ASSERT_EQ(pid, waitpid(pid, &status, 0));
328 ASSERT_TRUE(WIFEXITED(status));
329 ASSERT_EQ(99, WEXITSTATUS(status));
330}
331
332static int quick_exit_status = 0;
333
334static void quick_exit_1(void) {
335 ASSERT_EQ(quick_exit_status, 0);
336 quick_exit_status = 1;
337}
338
339static void quick_exit_2(void) {
340 ASSERT_EQ(quick_exit_status, 1);
341}
342
343static void not_run(void) {
344 FAIL();
345}
346
347TEST(stdlib, at_quick_exit) {
348 pid_t pid = fork();
349 ASSERT_NE(-1, pid) << strerror(errno);
350
351 if (pid == 0) {
352 ASSERT_EQ(at_quick_exit(quick_exit_2), 0);
353 ASSERT_EQ(at_quick_exit(quick_exit_1), 0);
354 atexit(not_run);
355 quick_exit(99);
356 }
357
358 int status;
359 ASSERT_EQ(pid, waitpid(pid, &status, 0));
360 ASSERT_TRUE(WIFEXITED(status));
361 ASSERT_EQ(99, WEXITSTATUS(status));
362}
363
Elliott Hughes9f525642014-04-08 17:14:01 -0700364TEST(unistd, _Exit) {
365 int pid = fork();
366 ASSERT_NE(-1, pid) << strerror(errno);
367
368 if (pid == 0) {
369 _Exit(99);
370 }
371
372 int status;
373 ASSERT_EQ(pid, waitpid(pid, &status, 0));
374 ASSERT_TRUE(WIFEXITED(status));
375 ASSERT_EQ(99, WEXITSTATUS(status));
376}
Elliott Hughes49167062014-07-25 17:24:00 -0700377
378TEST(stdlib, pty_smoke) {
379 // getpt returns a pty with O_RDWR|O_NOCTTY.
380 int fd = getpt();
381 ASSERT_NE(-1, fd);
382
383 // grantpt is a no-op.
384 ASSERT_EQ(0, grantpt(fd));
385
386 // ptsname_r should start "/dev/pts/".
387 char name_r[128];
388 ASSERT_EQ(0, ptsname_r(fd, name_r, sizeof(name_r)));
389 name_r[9] = 0;
390 ASSERT_STREQ("/dev/pts/", name_r);
391
392 close(fd);
393}
394
395TEST(stdlib, posix_openpt) {
396 int fd = posix_openpt(O_RDWR|O_NOCTTY|O_CLOEXEC);
397 ASSERT_NE(-1, fd);
398 close(fd);
399}
400
401TEST(stdlib, ptsname_r_ENOTTY) {
402 errno = 0;
403 char buf[128];
404 ASSERT_EQ(ENOTTY, ptsname_r(STDOUT_FILENO, buf, sizeof(buf)));
405 ASSERT_EQ(ENOTTY, errno);
406}
407
408TEST(stdlib, ptsname_r_EINVAL) {
409 int fd = getpt();
410 ASSERT_NE(-1, fd);
411 errno = 0;
412 char* buf = NULL;
413 ASSERT_EQ(EINVAL, ptsname_r(fd, buf, 128));
414 ASSERT_EQ(EINVAL, errno);
415 close(fd);
416}
417
418TEST(stdlib, ptsname_r_ERANGE) {
419 int fd = getpt();
420 ASSERT_NE(-1, fd);
421 errno = 0;
422 char buf[1];
423 ASSERT_EQ(ERANGE, ptsname_r(fd, buf, sizeof(buf)));
424 ASSERT_EQ(ERANGE, errno);
425 close(fd);
426}
427
428TEST(stdlib, ttyname_r) {
429 int fd = getpt();
430 ASSERT_NE(-1, fd);
431
432 // ttyname_r returns "/dev/ptmx" for a pty.
433 char name_r[128];
434 ASSERT_EQ(0, ttyname_r(fd, name_r, sizeof(name_r)));
435 ASSERT_STREQ("/dev/ptmx", name_r);
436
437 close(fd);
438}
439
440TEST(stdlib, ttyname_r_ENOTTY) {
441 int fd = open("/dev/null", O_WRONLY);
442 errno = 0;
443 char buf[128];
444 ASSERT_EQ(ENOTTY, ttyname_r(fd, buf, sizeof(buf)));
445 ASSERT_EQ(ENOTTY, errno);
446 close(fd);
447}
448
449TEST(stdlib, ttyname_r_EINVAL) {
450 int fd = getpt();
451 ASSERT_NE(-1, fd);
452 errno = 0;
453 char* buf = NULL;
454 ASSERT_EQ(EINVAL, ttyname_r(fd, buf, 128));
455 ASSERT_EQ(EINVAL, errno);
456 close(fd);
457}
458
459TEST(stdlib, ttyname_r_ERANGE) {
460 int fd = getpt();
461 ASSERT_NE(-1, fd);
462 errno = 0;
463 char buf[1];
464 ASSERT_EQ(ERANGE, ttyname_r(fd, buf, sizeof(buf)));
465 ASSERT_EQ(ERANGE, errno);
466 close(fd);
467}
468
469TEST(stdlib, unlockpt_ENOTTY) {
470 int fd = open("/dev/null", O_WRONLY);
471 errno = 0;
472 ASSERT_EQ(-1, unlockpt(fd));
473 ASSERT_EQ(ENOTTY, errno);
474 close(fd);
475}
Elliott Hughesb05ec5a2014-09-23 14:53:10 -0700476
477TEST(stdlib, strtol_EINVAL) {
478 errno = 0;
479 strtol("123", NULL, -1);
480 ASSERT_EQ(EINVAL, errno);
481 errno = 0;
482 strtol("123", NULL, 1);
483 ASSERT_EQ(EINVAL, errno);
484 errno = 0;
485 strtol("123", NULL, 37);
486 ASSERT_EQ(EINVAL, errno);
487}
488
489TEST(stdlib, strtoll_EINVAL) {
490 errno = 0;
491 strtoll("123", NULL, -1);
492 ASSERT_EQ(EINVAL, errno);
493 errno = 0;
494 strtoll("123", NULL, 1);
495 ASSERT_EQ(EINVAL, errno);
496 errno = 0;
497 strtoll("123", NULL, 37);
498 ASSERT_EQ(EINVAL, errno);
499}
500
501TEST(stdlib, strtoul_EINVAL) {
502 errno = 0;
503 strtoul("123", NULL, -1);
504 ASSERT_EQ(EINVAL, errno);
505 errno = 0;
506 strtoul("123", NULL, 1);
507 ASSERT_EQ(EINVAL, errno);
508 errno = 0;
509 strtoul("123", NULL, 37);
510 ASSERT_EQ(EINVAL, errno);
511}
512
513TEST(stdlib, strtoull_EINVAL) {
514 errno = 0;
515 strtoull("123", NULL, -1);
516 ASSERT_EQ(EINVAL, errno);
517 errno = 0;
518 strtoull("123", NULL, 1);
519 ASSERT_EQ(EINVAL, errno);
520 errno = 0;
521 strtoull("123", NULL, 37);
522 ASSERT_EQ(EINVAL, errno);
523}