Commit Graph

63 Commits

Author SHA1 Message Date
Wildan M c234ace91d Use ArrayString for Cwd 2026-06-22 22:13:24 +07:00
Wildan M 2c23024245 Fix possible signal race in tests 2026-05-09 11:14:19 +07:00
Wildan M c15059e205 Workaround nice test hit the ceiling 2026-05-09 05:48:45 +07:00
Wildan M e9c3960c65 Implement nice and write test 2026-05-09 01:23:37 +07:00
Wildan M 043ec22076 FIx sigjmp_buf and add tests 2026-05-02 16:59:48 +07:00
Zero 5cbb4ba0cc test(unistd): Add alarm(2) test
Introduce a new test for the alarm(2) system call.
This test verifies the behavior of setting, cancelling,
and re-arming alarms, ensuring correct signal delivery
and return values.
2026-03-31 00:09:07 +02:00
Wildan M 46379d7001 Make test files buildable for glibc 2026-03-25 03:11:33 +07:00
Wildan M 96a09e6dc4 Disable failed tests 2026-03-17 07:09:54 +07:00
auronandace 5d6ae8fd3f add pthread.h to unistd fork test 2026-02-13 12:31:59 +00:00
Wildan M 7f30fd2c42 Restore correct sleep values 2026-01-05 14:38:39 +07:00
Wildan M f6fa58bbbc Fix NATIVE_RELIBC=0 2025-12-18 12:26:34 +07:00
Anhad Singh a7d08aa37e fix(tests/getopt_long): c should be an int not a char
`getopt_long` returns an `int` not a `char`. On aarch64 `char` is
unsigned but on x86 is signed. This is why it had worked so far without
any issues.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-12-01 14:55:00 +11:00
Wildan M a118d5659b Implement reading memory 2025-10-09 13:15:05 +07:00
Josh Megnauth c555503a35 Implement readlinkat
Like readlink except capability based. Most of this patch is refactoring
fstatat into a reusable, openat-like private function.
2025-09-18 01:27:55 +00:00
Wildan M d527cf455f Implement reading CPU count 2025-09-14 18:45:38 +07:00
Josh Megnauth c899feb774 Implement fstatat
Linux's variant uses the syscall as intended. Redox's variant uses fpath
to build a path to pass to fstat from the file descriptor plus the file
name. Unlike the syscall, this isn't atomic so the liminal space between
fpath/getcwd and fstat is subject to TOCTOU.

Beyond fstatat, I moved the stat test to its correct location and added
an assert since the output of the test is unchecked.

I also added AT_FDCWD which seems to be -100 across Unixes. The other
AT_* constants are unimplemented for now.
2025-08-27 08:21:41 -04:00
Josh Megnauth 9d2f5d95dc Implement confstr (unistd.h)
The implementation for confstr is straightforward. Most of the constants
return 1 on both musl and glibc. The only constant that doesn't is
required for Fish.

I also switched an #[unsafe(no_mangle)] from my last patch back
to a #[no_mangle] because we need to bump cbindgen. #[unsafe(no_mangle)]
is required for Rust 2024.
2025-08-22 22:13:51 -04:00
Ron Williams b7589a63c5 Fixes to improve signals for openposixtestsuite 2025-08-04 07:37:14 -06:00
Ron Williams c528c0885f Make nanosleep and sleep handle interrupts correctly, plus fix alarm 2025-01-31 21:10:14 +00:00
Ron Williams 9df3708a1a fix popen, improve tests 2024-12-26 17:14:15 -08:00
Agoston Szepessy a83d4cbced Implement getpass()
Also make fields in `termios` public; required for modifying them.

There's an new type of test: `EXPECT_INPUT_BINS`. These require a `.exp`
file to be present along with the `.c` file. The `.exp` file takes the
produced binary as an argument and sends input to the program. This is
useful for testing functions like `getpass()`.
2024-07-23 16:07:25 +02:00
Peter Limkilde Svendsen a91a4082c4 Add tests for unistd.h constants 2024-03-27 12:21:14 +00:00
Peter Limkilde Svendsen aea9e2b432 Panic when getpagesize() cannot succeed as specified 2024-02-19 00:19:03 +00:00
4lDO2 5f929ed51e Enable -Wextra in tests. 2023-11-12 12:07:49 +01:00
Jeremy Soller 2e5d4a4d25 Merge remote-tracking branch 'origin/truncate-n-mkfifo' 2020-01-20 11:17:15 -07:00
Jeremy Soller 10f2e0fefc Merge branch 'fd-dup-test-robusty' into 'master'
Fix fd dup tests to be more robust

See merge request redox-os/relibc!251
2020-01-20 17:48:43 +00:00
Graham MacDonald 18e1a5608f Re-enable netdb tests, fix compiler warning, improve brk coverage 2020-01-13 22:22:40 +00:00
Sean Kennedy a1c3510761 Fix fd dup tests to be more robust
i.e. not depending on the first fd to be 4.
2019-12-02 14:53:55 -05:00
Xavier L'Heureux 64f93fe6e0 Implement the truncate function 2019-09-17 19:57:43 -04:00
Mateusz Mikuła 9aac2672e3 Fix few warnings 2019-07-18 15:27:05 +02:00
Jeremy Soller 84745ca770 Fix fsync on Redox 2019-07-06 19:27:42 -06:00
Jeremy Soller 27d97f6fe0 Use O_DIRECTORY in unistd/fchdir 2019-07-06 19:21:11 -06:00
Jeremy Soller 634b2ed835 Use actual break in unistd/brk 2019-07-06 19:09:16 -06:00
jD91mZM2 bf13674e11 Merge branch 'getpagesize_check' into 'master'
Use try_from in getpagesize(), add test

See merge request redox-os/relibc!225
2019-07-01 11:03:58 +00:00
jD91mZM2 e35f22b3df WIP: pthread_atfork
WIP mainly because we *should* use thread locals, but #[thread_local]
causes segfaults.
2019-07-01 09:07:11 +02:00
Peter Limkilde Svendsen 3b06380738 Add test for getpagesize() 2019-06-14 00:06:11 +02:00
jD91mZM2 269b8a1d3e Merge branch 'cleanup' into 'master'
tests: Macro based error handling

See merge request redox-os/relibc!195
2019-03-03 15:19:19 +00:00
lmiskiew 5eb2a8f7bd Implement swab 2019-02-28 08:23:11 +00:00
Tibor Nagy fa2c6d29db tests: Rewrite libgen tests based on ctype (nice table layout), fix error handling of sleep tests 2019-02-25 19:32:20 +01:00
Tibor Nagy efd6947d8e tests: Fix function-like macros
Turns the results of these macros from compound to regular statements using the old `do { ... } while(0)` trick. Must have for function-like macros.
2019-02-25 14:13:02 +01:00
Tibor Nagy a92be000fb tests: Even more work on error handling
realpath: Fixing undefined behaviour in the second test. If the call fails the resolved_name argument cannot be used for error checking because its state is undefined by SUSv2.
pipe: Changing the order of close and write error handling code. Errors in close could overwrite errno after write errors, returning incorrect error messages.
gmtime: Removed duplicate checks
Other fixes for fseek, rename, mktime, putwchar
2019-02-24 22:02:11 +01:00
Tibor Nagy 2d027f0771 tests: More work on error handling 2019-02-24 00:46:26 +01:00
Tibor Nagy 9a0ea6ff34 tests: More refactoring, add helper header to every test, override exit for better error reporting 2019-02-21 21:13:28 +01:00
Tibor Nagy 64acf45c40 tests: Add helper macros for easier error handling and reporting 2019-02-21 17:35:24 +01:00
Tibor Nagy f60c95d2ca tests: Work on more thorough error handling 2019-02-21 16:15:49 +01:00
Tibor Nagy d1a424c002 tests: Replace returns with exits in the main functions
This will allow us to redefine the exit function.

For example:
```
#define exit(code) { \
    fprintf(stderr, "%s:%d: exit(%s) in function ‘%s’\n",
        __FILE__, __LINE__, #code, __func__); \
    _exit(code); \
}
```
2019-02-21 12:15:06 +01:00
Tibor Nagy 4381bb2a22 tests: Remove redundant return statements
When the execution reaches the end of the main functions, they implicitly return a successful status.
2019-02-20 21:09:03 +01:00
Tibor Nagy c19cc8b731 tests: Portability fixes, replaced 0/1/-1 return codes with macros 2019-02-20 20:20:07 +01:00
Tibor Nagy ff874c87d7 tests: Fix function signatures 2019-02-20 19:27:18 +01:00
Tibor Nagy 7ee59d2fdb tests: set C11, enable pedantic warnings, fix GCC and Clang warnings 2019-02-20 15:04:47 +01:00