Skip to content

Commit

Permalink
Merge pull request #281 from andrey-terekhov/llvm-testing
Browse files Browse the repository at this point in the history
LLVM testing fix
  • Loading branch information
Victor-Y-Fadeev authored Mar 9, 2022
2 parents 71a75e2 + e159265 commit 1968d97
Show file tree
Hide file tree
Showing 14 changed files with 174 additions and 134 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ jobs:
name: macOS
runs-on: macos-latest
steps:
- name: Set up environment
run: brew install coreutils
- name: GitHub repository checkout
uses: actions/checkout@v2
with:
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/llvm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test on LLVM

on:
- push
- pull_request

jobs:
windows:
name: Windows Server 2019
runs-on: windows-2019
steps:
- name: GitHub repository checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run script
shell: bash
run: |
patch ./scripts/test.sh < ./scripts/llvm.patch
./scripts/test.sh
ubuntu:
name: Ubuntu 20.04
runs-on: ubuntu-20.04
steps:
- name: GitHub repository checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run script
run: |
patch ./scripts/test.sh < ./scripts/llvm.patch
./scripts/test.sh
macos:
name: macOS Big Sur 11
runs-on: macos-11
steps:
- name: GitHub repository checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up environment
run: brew install coreutils
- name: Run script
run: |
patch ./scripts/test.sh < ./scripts/llvm.patch
./scripts/test.sh
45 changes: 0 additions & 45 deletions .github/workflows/tests.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/virtual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test on Virtual machine

on:
- push
- pull_request

jobs:
windows:
name: Windows Server 2019
runs-on: windows-2019
steps:
- name: GitHub repository checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run script
shell: bash
run: ./scripts/test.sh

ubuntu:
name: Ubuntu 20.04
runs-on: ubuntu-20.04
steps:
- name: GitHub repository checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run script
run: ./scripts/test.sh

macos:
name: macOS Big Sur 11
runs-on: macos-11
steps:
- name: GitHub repository checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up environment
run: brew install coreutils
- name: Run script
run: ./scripts/test.sh
13 changes: 11 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,23 @@ virtual:
script:
- ./scripts/test.sh

llvm-intel:
stage: llvm
before_script:
- apt-get update
- apt-get install -y build-essential cmake clang-11 gcc-mipsel-linux-gnu
script:
- patch ./scripts/test.sh < ./scripts/llvm.patch
- ./scripts/test.sh

llvm-baikal:
stage: llvm
before_script:
- apt-get update
- apt-get install -y build-essential cmake clang-11 gcc-mipsel-linux-gnu sshpass
script:
- patch ./scripts/test.sh < ./scripts/llvm-baikal.patch
- ./scripts/test.sh
- ./scripts/test.sh -d

llvm-uemu:
stage: llvm
Expand All @@ -32,4 +41,4 @@ llvm-uemu:
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.softcom.su/ruc/uemu ../uemu
script:
- patch ./scripts/test.sh < ./scripts/llvm-uemu.patch
- ./scripts/test.sh
- ./scripts/test.sh -d
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)


if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
if(MSVC)
# Starting in Visual Studio 2019 version 16.8, you may specify /std:c11
add_compile_options(/W4 /WX /wd4204 /wd4221 /wd5105 /utf-8
"$<$<VERSION_GREATER_EQUAL:MSVC_VERSION,1928>:/std:c11>"
Expand All @@ -39,6 +39,12 @@ endif()
add_compile_definitions("$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")


# Import testing exit code
if(DEFINED TESTING_EXIT_CODE)
add_compile_definitions(TESTING_EXIT_CODE=${TESTING_EXIT_CODE})
endif()


# Add libraries
add_subdirectory(libs)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Tests](https://github.com/andrey-terekhov/RuC/actions/workflows/tests.yml/badge.svg)](https://github.com/andrey-terekhov/RuC/actions/workflows/tests.yml)
[![Virtual](https://github.com/andrey-terekhov/RuC/actions/workflows/virtual.yml/badge.svg)](https://github.com/andrey-terekhov/RuC/actions/workflows/virtual.yml) [![LLVM](https://github.com/andrey-terekhov/RuC/actions/workflows/virtual.yml/badge.svg)](https://github.com/andrey-terekhov/RuC/actions/workflows/virtual.yml)
# ![Logo](https://raw.githubusercontent.com/Victor-Y-Fadeev/RuC-WPF/master/RuC.WPF/Images/Repository.png) Russian C

Этот репозиторий содержит компилятор языка RuC.
Expand Down
2 changes: 1 addition & 1 deletion libs/compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(${PROJECT_NAME} preprocessor utils)

if(NOT CMAKE_C_COMPILER_ID STREQUAL "MSVC")
if(NOT MSVC)
target_link_libraries(${PROJECT_NAME} m)
endif()
28 changes: 20 additions & 8 deletions scripts/llvm-baikal.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
--- test.sh 2022-02-28 19:18:46.488161200 +0300
+++ llvm.sh 2022-02-28 19:22:24.132779300 +0300
@@ -3,7 +3,8 @@
--- test.sh 2022-03-09 20:38:58.473520400 +0300
+++ llvm.sh 2022-03-09 20:40:27.502109200 +0300
@@ -3,7 +3,9 @@
init()
{
exit_code=1
- vm_exec=export.txt
+ vm_exec=export.ll
+ llvm_exec=export
+

vm_release=master
output_time=0.0
@@ -175,10 +176,6 @@
@@ -22,6 +24,7 @@
subdir_error=errors
subdir_warning=warnings
subdir_include=include
+ subdir_no_llvm=no-llvm

while ! [[ -z $1 ]]
do
@@ -185,10 +188,6 @@
else
compiler_debug=$compiler
fi
Expand All @@ -21,7 +30,7 @@
}

run()
@@ -259,7 +256,8 @@
@@ -269,7 +268,8 @@
{
if [[ $path == $dir_exec/* ]] ; then
action="execution"
Expand All @@ -31,11 +40,14 @@

case $? in
0)
@@ -350,7 +348,7 @@
@@ -379,9 +379,9 @@
compiling()
{
if [[ -z $ignore || $path != $dir_error/* ]] ; then
if [[ -z $ignore || $path != $dir_lexing/* || $path != $dir_preprocessor/* || $path != $dir_semantics/*
- || $path != $dir_syntax/* || $path != $dir_multiple_errors/* || $path != $dir_unsorted/* ]] ; then
+ || $path != $dir_syntax/* || $path != $dir_multiple_errors/* || $path != $dir_unsorted/* ]] && [[ $path != */$subdir_no_llvm/* ]] ; then
action="compiling"
- run $compiler $compiler_debug $sources -o $vm_exec
- run $compiler $compiler_debug $sources -o $vm_exec -VM
+ run $compiler $compiler_debug $sources -LLVM -o $vm_exec && clang-11 --target=mipsel-linux-gnu -static $vm_exec -lm -o $llvm_exec &>$log

case $? in
Expand Down
28 changes: 20 additions & 8 deletions scripts/llvm-uemu.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
--- test.sh 2022-02-28 19:18:46.488161200 +0300
+++ llvm.sh 2022-02-28 19:23:37.950288100 +0300
@@ -3,7 +3,8 @@
--- test.sh 2022-03-09 20:38:58.473520400 +0300
+++ llvm.sh 2022-03-09 20:38:42.886707100 +0300
@@ -3,7 +3,9 @@
init()
{
exit_code=1
- vm_exec=export.txt
+ vm_exec=export.ll
+ llvm_exec=export
+

vm_release=master
output_time=0.0
@@ -175,10 +176,6 @@
@@ -22,6 +24,7 @@
subdir_error=errors
subdir_warning=warnings
subdir_include=include
+ subdir_no_llvm=no-llvm

while ! [[ -z $1 ]]
do
@@ -185,10 +188,6 @@
else
compiler_debug=$compiler
fi
Expand All @@ -21,7 +30,7 @@
}

run()
@@ -259,7 +256,8 @@
@@ -269,7 +268,8 @@
{
if [[ $path == $dir_exec/* ]] ; then
action="execution"
Expand All @@ -31,11 +40,14 @@

case $? in
0)
@@ -350,7 +348,7 @@
@@ -379,9 +379,9 @@
compiling()
{
if [[ -z $ignore || $path != $dir_error/* ]] ; then
if [[ -z $ignore || $path != $dir_lexing/* || $path != $dir_preprocessor/* || $path != $dir_semantics/*
- || $path != $dir_syntax/* || $path != $dir_multiple_errors/* || $path != $dir_unsorted/* ]] ; then
+ || $path != $dir_syntax/* || $path != $dir_multiple_errors/* || $path != $dir_unsorted/* ]] && [[ $path != */$subdir_no_llvm/* ]] ; then
action="compiling"
- run $compiler $compiler_debug $sources -o $vm_exec
- run $compiler $compiler_debug $sources -o $vm_exec -VM
+ run $compiler $compiler_debug $sources -LLVM -o $vm_exec && clang-11 --target=mipsel-linux-gnu -static $vm_exec -lm -o $llvm_exec &>$log

case $? in
Expand Down
Loading

0 comments on commit 1968d97

Please sign in to comment.