mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
* netbsd fail on error
- Group each BSD test in its own subshell. Without this, if an error
occurs, it exits, but we don't know "where" it failed
- added *usesh: true* to BSD for faster copying into the virtualbox VM
- Some test_suite_runners wheren't correctly printing. added
--no-terminal
- For testing I've changed *build-msvc* from Debug to RelWithDebInfo
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* separate runs
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* fix typo
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* Split msvc-debug into separate workflow
Run msvc-debug only on maintainer pushes, keep CI fast and still catches
errors.
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* Fix build and test errors on NetBSD
* Set proper sizes for various types used for threads
* Add num_cpu function
* Add sysctl constants
* Allow testproject to build on NetBSD
* Tweaks to the linker code so that it adds correct flags and finds dynamic linker on NetBSD
* bsd: force system linker test
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* system linker on openbsd
remove lld from netbsd
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* use cc linker in openbsd, and re-add lld for netbsd
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* openbsd: fixes
- implement num_cpu() for OPENBSD
- testproject: add openbsd
- linker.c: fix for openbsd
- bsd refactor main.yml and more fixes
* openbsd: fix for unit tests and test_suite_runner
openbsd now passes all tests except the 'dynlib-test' which yields
'relocation error' when running `cc test.c -L. -ladd -Wl,-rpath=.`
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* openbsd: guard/disable unit test test_ct_intlog2()
* build-msys2-clang: add all tests that build-msvc has
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* Fix Windows import library generation by adding /IMPLIB support and properly declaring static_lib_name()
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* build-msys2-mingw: add all tests that build-msvc has and enable it
configure CMake to link LLVM and LLD statically
* Revert "Revert windows"
This reverts commit 197f82d829.
* win-llvm 21.1.8
uses the RelWithDebInfo+Assertions
* refactor(CI): Centralize test logic and fix Docker execution
This commit refactors the GitHub Actions workflow to improve
maintainability and correct a flaw in the Docker build.
- Ensures Docker based tests run *inside* the generated container, not
on the host. This also fixes environment isolation and user permission
errors.
- Centralizes all common test steps (examples, libs, unit tests, etc)
into a single, auto-detecting Bash script: `scripts/tools/ci_tests.sh`.
- Centralize all release artifact packaging into a single
`scripts/tools/package_build.sh`
- fixes using correct paths for test_suite_runner when running on
windows under bash.
- This significantly reduces YAML duplication, making `main.yml` more
readable and easier to maintain.
This one supersedes pull/2677, and includes the fixes for:
- fix openbsd and netbsd
- added win-llvm 21.1.8 and fixed CMakeLists.txt
- added full unit-tests and suite for build-msys2-mingw and
build-msys2-clang
* macos: add/fix build for llvm (19,20,21)
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* ci: run tests in temp dir to avoid workspace pollution
Executes ci_tests.sh in a disposable temporary directory by copying
resources/ and test/ folders, preventing build artifacts from cluttering
the source tree.
This makes it easy to run `scripts/tools/ci_tests.sh` locally on any
platform.
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* add ilammy/msvc-dev-cmd@ and Ninja
we can simplify the windows runner and run everything in bash
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* windows: drain subprocess stderr before join to avoid test_suite_runner hang
* move last test to `ci_tests.sh`
thus completing the centralization of tests in `ci_tests.sh`
* Fix Windows CI cache
Updates the cache key to include hashes of CMakeLists.txt and the
workflow file.
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* `package_build.sh` runs in temp dir to avoid workspace pollution
- add cleanup
* nix: use `ci_tests.sh`
* remove annoying build-mac warnings
This now checks if package already installed trying to prevent
annoying warnings in the github ci:
Fixes:
```
build-mac (Release, 19)curl 8.17.0 is already installed and up-to-date.
To reinstall 8.17.0, run: brew reinstall curl
```
* refactor test_suite_runner
- less allocations, cleaner code, more maintainable.
- now can be killed and the temp dirs are correctly cleaned up, and the
output is correct.
* main.yml: bsd: change to using rsync, is twice as fast.
* default to `--wincrt=dynamic` when `--sanitize=address` on windows
Default to dynamic, as static ASan is removed in LLVM 21+ for Windows
https://github.com/llvm/llvm-project/pull/107899
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* Formatting (indent with tab, align with space). Fix K&R braces. Style: keep all cases multiline if one is.
---------
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
Co-authored-by: Alex Garrett <limit.ordinal17@gmail.com>
129 lines
5.9 KiB
Plaintext
129 lines
5.9 KiB
Plaintext
module std::os::posix @if(env::POSIX);
|
|
import std::thread;
|
|
import libc;
|
|
|
|
const PTHREAD_MUTEX_NORMAL = 0;
|
|
const PTHREAD_MUTEX_ERRORCHECK = env::LINUX ? 2 : 1;
|
|
const PTHREAD_MUTEX_RECURSIVE = env::LINUX ? 1 : 2;
|
|
|
|
alias PosixThreadFn = fn void*(void*);
|
|
typedef Pthread_t = void*;
|
|
|
|
extern fn Errno pthread_create(Pthread_t*, Pthread_attr_t*, PosixThreadFn, void*);
|
|
extern fn Errno pthread_cancel(Pthread_t*);
|
|
extern fn Errno pthread_detach(Pthread_t);
|
|
extern fn Errno pthread_equal(Pthread_t this, Pthread_t other);
|
|
extern fn void pthread_exit(void* value_ptr) @noreturn;
|
|
extern fn Errno pthread_join(Pthread_t, void** value_ptr);
|
|
extern fn Errno pthread_kill(Pthread_t, CInt sig);
|
|
extern fn void pthread_once(Pthread_once_t*, OnceFn);
|
|
extern fn Pthread_t pthread_self();
|
|
extern fn Errno pthread_setcancelstate(CInt state, CInt* oldstate);
|
|
extern fn Errno pthread_setcanceltype(CInt type, CInt* oldtype);
|
|
extern fn Errno pthread_testcancel();
|
|
|
|
extern fn Errno pthread_attr_destroy(Pthread_attr_t*);
|
|
extern fn Errno pthread_attr_getinheritsched(Pthread_attr_t*, CInt*);
|
|
extern fn Errno pthread_attr_getschedparam(Pthread_attr_t*, Pthread_sched_param*);
|
|
extern fn Errno pthread_attr_getschedpolicy(Pthread_attr_t*, CInt*);
|
|
extern fn Errno pthread_attr_getscope(Pthread_attr_t*, CInt*);
|
|
extern fn Errno pthread_attr_getstacksize(Pthread_attr_t*, usz*);
|
|
extern fn Errno pthread_attr_getstackaddr(Pthread_attr_t*, void**);
|
|
extern fn Errno pthread_attr_getdetachstate(Pthread_attr_t*, CInt*);
|
|
extern fn Errno pthread_attr_init(Pthread_attr_t*);
|
|
extern fn Errno pthread_attr_setinheritsched(Pthread_attr_t*, CInt);
|
|
extern fn Errno pthread_attr_setschedparam(Pthread_attr_t*, Pthread_sched_param*);
|
|
extern fn Errno pthread_attr_setschedpolicy(Pthread_attr_t*, CInt);
|
|
extern fn Errno pthread_attr_setscope(Pthread_attr_t*, CInt);
|
|
extern fn Errno pthread_attr_setstacksize(Pthread_attr_t*, usz);
|
|
extern fn Errno pthread_attr_setstackaddr(Pthread_attr_t*, void*);
|
|
extern fn Errno pthread_attr_setdetachstate(Pthread_attr_t*, CInt);
|
|
|
|
extern fn Errno pthread_mutexattr_destroy(Pthread_mutexattr_t*);
|
|
extern fn Errno pthread_mutexattr_getprioceiling(Pthread_mutexattr_t*, CInt*);
|
|
extern fn Errno pthread_mutexattr_getprotocol(Pthread_mutexattr_t*, CInt*);
|
|
extern fn Errno pthread_mutexattr_gettype(Pthread_mutexattr_t*, CInt*);
|
|
extern fn Errno pthread_mutexattr_init(Pthread_mutexattr_t*);
|
|
extern fn Errno pthread_mutexattr_setprioceiling(Pthread_mutexattr_t*, CInt);
|
|
extern fn Errno pthread_mutexattr_setprotocol(Pthread_mutexattr_t*, CInt);
|
|
extern fn Errno pthread_mutexattr_settype(Pthread_mutexattr_t*, CInt);
|
|
|
|
extern fn Errno pthread_mutex_destroy(Pthread_mutex_t*);
|
|
extern fn Errno pthread_mutex_init(Pthread_mutex_t*, Pthread_mutexattr_t*);
|
|
extern fn Errno pthread_mutex_lock(Pthread_mutex_t*);
|
|
extern fn Errno pthread_mutex_trylock(Pthread_mutex_t*);
|
|
extern fn Errno pthread_mutex_unlock(Pthread_mutex_t*);
|
|
|
|
extern fn Errno pthread_condattr_destroy(Pthread_condattr_t*);
|
|
extern fn Errno pthread_condattr_init(Pthread_condattr_t*);
|
|
|
|
extern fn Errno pthread_cond_broadcast(Pthread_cond_t*);
|
|
extern fn Errno pthread_cond_destroy(Pthread_cond_t*);
|
|
extern fn Errno pthread_cond_init(Pthread_cond_t*, Pthread_condattr_t*);
|
|
extern fn Errno pthread_cond_signal(Pthread_cond_t*);
|
|
extern fn Errno pthread_cond_timedwait(Pthread_cond_t*, Pthread_mutex_t*, TimeSpec*);
|
|
extern fn Errno pthread_cond_wait(Pthread_cond_t*, Pthread_mutex_t*);
|
|
|
|
extern fn Errno pthread_rwlock_destroy(Pthread_rwlock_t*);
|
|
extern fn Errno pthread_rwlock_init(Pthread_rwlock_t*, Pthread_rwlockattr_t*);
|
|
extern fn Errno pthread_rwlock_rdlock(Pthread_rwlock_t*);
|
|
extern fn Errno pthread_rwlock_tryrdlock(Pthread_rwlock_t*);
|
|
extern fn Errno pthread_rwlock_trywrlock(Pthread_rwlock_t*);
|
|
extern fn Errno pthread_rwlock_unlock(Pthread_rwlock_t*);
|
|
extern fn Errno pthread_rwlock_wrlock(Pthread_rwlock_t*);
|
|
|
|
extern fn Errno pthread_rwlockattr_destroy(Pthread_rwlockattr_t*);
|
|
extern fn Errno pthread_rwlockattr_getpshared(Pthread_rwlockattr_t*, CInt*);
|
|
extern fn Errno pthread_rwlockattr_init(Pthread_rwlockattr_t*);
|
|
extern fn Errno pthread_rwlockattr_setpshared(Pthread_rwlockattr_t*, CInt);
|
|
|
|
extern fn Errno pthread_key_create(Pthread_key_t*, PosixThreadFn routine);
|
|
extern fn Errno pthread_key_delete(Pthread_key_t);
|
|
extern fn void* pthread_getspecific(Pthread_key_t);
|
|
extern fn Errno pthread_setspecific(Pthread_key_t, void* value_ptr);
|
|
|
|
extern fn Errno pthread_atfork(OnceFn prepare, OnceFn parent, OnceFn child);
|
|
extern fn void pthread_cleanup_pop(CInt execute);
|
|
extern fn void pthread_cleanup_push(PosixThreadFn routine, void* routine_arg);
|
|
|
|
extern fn int sched_yield();
|
|
|
|
module std::thread::os @if(env::POSIX && !env::LINUX && !env::NETBSD);
|
|
typedef Pthread_attr_t = ulong[8];
|
|
typedef Pthread_cond_t = ulong[6];
|
|
typedef Pthread_condattr_t = ulong[8];
|
|
typedef Pthread_key_t = ulong;
|
|
typedef Pthread_mutex_t = ulong[8];
|
|
typedef Pthread_mutexattr_t = ulong[2];
|
|
typedef Pthread_once_t = ulong[2];
|
|
typedef Pthread_rwlock_t = ulong[25];
|
|
typedef Pthread_rwlockattr_t = ulong[3];
|
|
typedef Pthread_sched_param = ulong;
|
|
|
|
module std::thread::os @if(env::LINUX);
|
|
typedef Pthread_attr_t = ulong[7]; // 24 on 32bit
|
|
typedef Pthread_cond_t = ulong[6];
|
|
typedef Pthread_condattr_t = uint;
|
|
typedef Pthread_key_t = uint;
|
|
typedef Pthread_mutex_t = ulong[5]; // 24 on 32 bit
|
|
typedef Pthread_mutexattr_t = uint;
|
|
typedef Pthread_once_t = int;
|
|
typedef Pthread_rwlock_t = ulong[7]; // 32 on 3bit
|
|
typedef Pthread_rwlockattr_t = uint;
|
|
typedef Pthread_sched_param = uint;
|
|
|
|
module std::thread::os @if(env::NETBSD);
|
|
typedef Pthread_attr_t = ulong[2];
|
|
typedef Pthread_cond_t = ulong[5];
|
|
typedef Pthread_condattr_t = ulong[2];
|
|
typedef Pthread_key_t = uint;
|
|
typedef Pthread_mutexattr_t = ulong[2];
|
|
typedef Pthread_rwlock_t = ulong[8];
|
|
typedef Pthread_rwlockattr_t = ulong[2];
|
|
typedef Pthread_sched_param = int;
|
|
|
|
typedef Pthread_mutex_t @if(env::X86_64)= ulong[6];
|
|
typedef Pthread_once_t @if(env::X86_64) = ulong[7];
|
|
typedef Pthread_mutex_t @if(!env::X86_64) = ulong[5];
|
|
typedef Pthread_once_t @if(!env::X86_64) = ulong[6];
|