mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
CI testing (#234)
* run test in CI * make CI run * fix some issues with paths on Windows * avoid using float80 * add mingw64 ci * fix path issue in tests * add lld for mingw64 CI
This commit is contained in:
53
.github/workflows/main.yml
vendored
53
.github/workflows/main.yml
vendored
@@ -2,11 +2,44 @@ name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, dev, windows_compatibility ]
|
||||
branches: [ master, dev, ci_testing ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build-msys2-mingw:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
build_type: [Release, Debug]
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: MINGW64
|
||||
update: true
|
||||
install: git binutils mingw-w64-x86_64-cmake mingw-w64-x86_64-toolchain mingw-w64-x86_64-llvm mingw-w64-x86_64-polly mingw-w64-x86_64-python mingw-w64-x86_64-lld
|
||||
|
||||
- name: CMake
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
||||
cmake --build .
|
||||
|
||||
- name: Build testproject
|
||||
run: |
|
||||
cd resources/testproject
|
||||
../../build/c3c build
|
||||
|
||||
- name: run compiler tests
|
||||
run: |
|
||||
cd test
|
||||
python3 src/tester.py ../build/c3c.exe test_suite/
|
||||
|
||||
build-msys2-clang:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
@@ -22,18 +55,23 @@ jobs:
|
||||
with:
|
||||
msystem: CLANG64
|
||||
update: true
|
||||
install: git binutils mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-toolchain
|
||||
install: git binutils mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-toolchain mingw-w64-clang-x86_64-python
|
||||
|
||||
- name: CMake
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
/clang64/bin/cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
||||
/clang64/bin/cmake --build .
|
||||
cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
||||
cmake --build .
|
||||
- name: Build testproject
|
||||
run: |
|
||||
cd resources/testproject
|
||||
../../build/c3c build
|
||||
|
||||
- name: run compiler tests
|
||||
run: |
|
||||
cd test
|
||||
python3 src/tester.py ../build/c3c.exe test_suite/
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
@@ -44,7 +82,7 @@ jobs:
|
||||
- uses: actions/checkout@v1
|
||||
- name: (Ubuntu) Download LLVM
|
||||
run: |
|
||||
sudo apt-get install zlib1g zlib1g-dev clang-11 libllvm11 llvm-11 llvm-11-dev llvm-11-runtime liblld-11-dev liblld-11
|
||||
sudo apt-get install zlib1g zlib1g-dev clang-11 libllvm11 llvm-11 llvm-11-dev llvm-11-runtime liblld-11-dev liblld-11 python3
|
||||
|
||||
- name: CMake
|
||||
run: |
|
||||
@@ -56,3 +94,8 @@ jobs:
|
||||
run: |
|
||||
cd resources/testproject
|
||||
../../build/c3c build
|
||||
|
||||
- name: run compiler tests
|
||||
run: |
|
||||
cd test
|
||||
python3 src/tester.py ../build/c3c test_suite/
|
||||
|
||||
@@ -165,6 +165,7 @@ if (WIN32)
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_C_COMPILE_ID STREQUAL "GNU")
|
||||
target_link_options(c3c PRIVATE -pthread)
|
||||
target_compile_definitions(c3c PRIVATE USE_PTHREAD=1)
|
||||
target_compile_options(c3c PRIVATE -mlong-double-64)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ const char* find_lib_dir(void)
|
||||
struct stat info;
|
||||
char *lib_path = NULL;
|
||||
|
||||
asprintf(&lib_path, "%s../lib/std/", path);
|
||||
asprintf(&lib_path, "%s../lib/std", path);
|
||||
DEBUG_LOG("Checking %s", lib_path);
|
||||
int err = stat(lib_path, &info);
|
||||
|
||||
@@ -115,7 +115,7 @@ const char* find_lib_dir(void)
|
||||
return lib_path;
|
||||
}
|
||||
|
||||
asprintf(&lib_path, "%slib/std/", path);
|
||||
asprintf(&lib_path, "%slib/std", path);
|
||||
err = stat(lib_path, &info);
|
||||
|
||||
// Found it at ./lib/std
|
||||
@@ -225,6 +225,10 @@ char *realpath(const char *path, char *const resolved_path)
|
||||
if (NULL == resolved_path) free(result);
|
||||
return NULL;
|
||||
}
|
||||
for (char *c = result; *c != '\0'; ++c)
|
||||
{
|
||||
if ('\\' == *c) *c = '/';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -416,6 +416,10 @@ const char *find_executable_path(void)
|
||||
char *path = malloc(len + 1);
|
||||
get_executable_path_raw(path, len, NULL);
|
||||
path[len] = '\0';
|
||||
for (int i = 0; i < len; ++i)
|
||||
{
|
||||
if ('\\' == path[i]) path[i] = '/';
|
||||
}
|
||||
for (int i = len - 1; i >= 0; i--)
|
||||
{
|
||||
switch (path[i])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import os, sys, shutil, subprocess
|
||||
import os, sys, shutil, subprocess, tempfile
|
||||
|
||||
TEST_DIR = '/tmp/c3test/'
|
||||
TEST_DIR = tempfile.mkdtemp().replace('\\', '/') + '/c3test/'
|
||||
|
||||
class Config:
|
||||
run_skipped = False
|
||||
|
||||
Reference in New Issue
Block a user