diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 71e58732c..13489b138 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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/ diff --git a/CMakeLists.txt b/CMakeLists.txt index efb134261..426d6dde5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/src/utils/file_utils.c b/src/utils/file_utils.c index 45bd19bc7..1c098b7b2 100644 --- a/src/utils/file_utils.c +++ b/src/utils/file_utils.c @@ -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; } diff --git a/src/utils/whereami.c b/src/utils/whereami.c index af007a312..104bbae77 100644 --- a/src/utils/whereami.c +++ b/src/utils/whereami.c @@ -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]) diff --git a/test/src/tester.py b/test/src/tester.py index 2307463a5..fab011acb 100644 --- a/test/src/tester.py +++ b/test/src/tester.py @@ -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