diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml deleted file mode 100644 index 256ff8dc..00000000 --- a/.github/workflows/cmake.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: CMake - -on: - push: - branches: [ "*" ] - pull_request: - branches: [ "*" ] - -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - -jobs: - build: - # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. - # You can convert this to a matrix build if you need cross-platform coverage. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Configure Refal - run: mkdir refal5 && cd ./refal5 && wget http://www.botik.ru/pub/local/scp/refal5/ref5_081222.zip && unzip ref5_081222.zip &&rm makefile && cp makefile.lin makefile && make - - name: test Refal - run: cd ./refal5 && export PATH=$PATH:$(pwd) && echo $(pwd) >> $GITHUB_PATH - - name: build Refal program - run: cd ./refal && ls *.ref && find . -type f -name "*.ref" | xargs refc && ls *.rsl - - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build - - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build - - diff --git a/.github/workflows/integrationTests.yml b/.github/workflows/integrationTests.yml index fca36c90..b52c7e6d 100644 --- a/.github/workflows/integrationTests.yml +++ b/.github/workflows/integrationTests.yml @@ -15,21 +15,13 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build - - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build - - - name: Test - #working-directory: ${{github.workspace}}/build/apps/TestsApp - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - # ну почему не из корня ... - #run: ctest -C ${{env.BUILD_TYPE}} - run: ./build/apps/IntegrationTestsApp/IntegrationTestsApp - - \ No newline at end of file + - name: Configure project + run: sudo ${{github.workspace}}/scripts/prerun.sh --with-tex + - name: Check Refal installed + run: | + if ! command -v refc &> /dev/null; then + echo "Ошибка: Refal не установлен." + exit 1 + fi + - name: Build Test File and check Reports + run: sudo ${{github.workspace}}/scripts/run_integration.sh \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d1a16e9..3fefd6f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,5 +15,4 @@ add_subdirectory(libs/InputGenerator) add_subdirectory(apps/InterpreterApp) add_subdirectory(apps/InputGeneratorApp) add_subdirectory(apps/UnitTestsApp) -add_subdirectory(apps/IntegrationTestsApp) add_subdirectory(apps/MetamorphicTestsApp) \ No newline at end of file diff --git a/apps/IntegrationTestsApp/CMakeLists.txt b/apps/IntegrationTestsApp/CMakeLists.txt deleted file mode 100644 index 24c2021d..00000000 --- a/apps/IntegrationTestsApp/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Set the project name -project(IntegrationTestsApp) - -# Create a sources variable with a link to all cpp files to compile - -include(FetchContent) -FetchContent_Declare( - googletest - URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip -) - -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) -FetchContent_MakeAvailable(googletest) - -set(SOURCES - src/main.cpp - src/IntegrationTests.cpp) - - -# Add a library with the above sources -add_executable(${PROJECT_NAME} ${SOURCES}) - -target_include_directories(${PROJECT_NAME} - PUBLIC ${PROJECT_SOURCE_DIR}/include - ) - -target_link_libraries(${PROJECT_NAME} - InputGenerator - Interpreter - Tester - Objects - gtest - ) - -enable_testing() -add_test(NAME IntegrationTests - COMMAND ${PROJECT_NAME}) \ No newline at end of file diff --git a/apps/IntegrationTestsApp/src/IntegrationTests.cpp b/apps/IntegrationTestsApp/src/IntegrationTests.cpp deleted file mode 100644 index 3497014c..00000000 --- a/apps/IntegrationTestsApp/src/IntegrationTests.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "gtest/gtest.h" \ No newline at end of file diff --git a/apps/IntegrationTestsApp/src/main.cpp b/apps/IntegrationTestsApp/src/main.cpp deleted file mode 100644 index bcb256e8..00000000 --- a/apps/IntegrationTestsApp/src/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -#include "gtest/gtest.h" - -using std::cout; - -int main(int argc, char** argv) { - cout << "Integration Tests\n"; - // Тестирование - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/scripts/install_packages.sh b/scripts/install_packages.sh deleted file mode 100755 index a35a6fab..00000000 --- a/scripts/install_packages.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -BASEDIR=$(pwd) -apt-get update -apt-get install -y make cmake dos2unix wget dot2tex build-essential dos2unix -read -p 'Установить TEX? Необходим для вывода в PDF (Y/N) ' need_tex -if [ "$need_tex" == "Y" ]; then - apt-get install -y texlive-latex-extra -fi -# install refal5 -if grep "refal" ~/.bashrc; then -echo "У вас уже есть РЕФАЛ, вы прекрасны!" -else -echo "Ставлю РЕФАЛ" -cd /usr/src -mkdir refal && cd refal -wget http://www.botik.ru/pub/local/scp/refal5/ref5_081222.zip -unzip ref5_081222.zip -rm makefile -cp makefile.lin makefile -make -echo "export PATH=$PATH:/usr/src/refal" >> ~/.bashrc -fi -cd $BASEDIR -rm -fR ./build -mkdir build -cd ./build/ -cmake ../. && cmake --build . -cd ../refal -dos2unix MathMode.ref -dos2unix Colorize.ref -dos2unix Postprocess.ref -dos2unix Preprocess.ref -dos2unix TestGenerator.ref -dos2unix FrameFormatter.ref -dos2unix RunFormatter.ref -export PATH=$PATH:/usr/src/refal -refc MathMode.ref -refc Colorize.ref -refc Postprocess.ref -refc Preprocess.ref -refc TestGenerator.ref -refc FrameFormatter.ref -refc RunFormatter.ref -cat ./../scripts/chipollino.txt -#Надо написать сборку рефал-программ когда они будут в одной ветке, возможно еще что-то надо (для текущего комиита все собирается) - вроде есть на будущее -#make diff --git a/scripts/integrationTests/1.txt b/scripts/integrationTests/1.txt new file mode 100644 index 00000000..f6a9322b --- /dev/null +++ b/scripts/integrationTests/1.txt @@ -0,0 +1,2 @@ +Test {(aa)*} {a*} 3 +Test (Glushkov {(aa)*}) {a*} 1 \ No newline at end of file diff --git a/scripts/integrationTests/2.txt b/scripts/integrationTests/2.txt new file mode 100644 index 00000000..5abc3250 --- /dev/null +++ b/scripts/integrationTests/2.txt @@ -0,0 +1,2 @@ +A = Complement.Annote (Glushkov {a*}) !! +B = States.Reverse A \ No newline at end of file diff --git a/resources/all_functions.txt b/scripts/integrationTests/all_functions.txt similarity index 100% rename from resources/all_functions.txt rename to scripts/integrationTests/all_functions.txt diff --git a/scripts/prerun.sh b/scripts/prerun.sh new file mode 100755 index 00000000..7e6d8a51 --- /dev/null +++ b/scripts/prerun.sh @@ -0,0 +1,56 @@ +#!/bin/bash +if [ "$EUID" -ne 0 ]; then + echo "Скрипт должен быть запущен с использованием sudo." + exit 1 +fi +with_tex=false +BASEDIR=$(pwd) +while [[ $# -gt 0 ]]; do + case "$1" in + --with-tex) + with_tex=true + shift + ;; + *) + echo "Неверный аргумент: $1" + exit 1 + ;; + esac +done + +# Добавление ключа репозитория +curl -s --compressed "https://xtoter.github.io/apt_packages/KEY.gpg" | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt_packages.gpg >/dev/null +# Добавление репозитория +sudo curl -s --compressed -o /etc/apt/sources.list.d/my_list_file.list "https://xtoter.github.io/apt_packages/my_list_file.list" +# Обновление списка пакетов +apt update +apt install -y make cmake dos2unix wget dot2tex build-essential dos2unix refal5-old +if [ "$with_tex" = true ]; then + apt install -y texlive-latex-extra texlive-fonts-extra texlive-science texlive-lang-cyrillic + +fi +# Начало компиляции ------------------------ +echo "Начало сборки" +# Сборка рефал частей +cd $BASEDIR/refal +# Чистим все собранное +rm -f *rsl + +for file in *.ref; do + # Проверка, существует ли файл + if [ -e "$file" ]; then + # Конвертация формата из DOS в UNIX + echo "Файл $file" + dos2unix "$file" + refc "$file" + fi +done + +# Сборка чиполлино +cd $BASEDIR +rm -fR ./build +mkdir build +cd ./build/ +cmake ../. && cmake --build . +# Конец +cat ./../scripts/chipollino.txt \ No newline at end of file diff --git a/scripts/readme.md b/scripts/readme.md index 9dec235e..96c8c7a5 100644 --- a/scripts/readme.md +++ b/scripts/readme.md @@ -19,15 +19,22 @@ * ```../test.txt``` - Тест (мы могли его генерировать) ## Linux +ВНИМАНИЕ! Все скрипты запускаются из корня проекта! +### Установка +Запускайте ```prerun.sh``` - он соберет и скачает все необходимое! +(Если вы хотите установить TEX для генерации отчета используйте флаг ```--with-tex```) +### Проверка корректности установки +Чтобы проверить корректность установки можно запустить ```run_integration.sh```. +### Работа с проектом + -Вы крутые, в текущем каталоге запускайте ```install_packages.sh``` - он соберет и скачает все необходимое! Для запуска Chipollino запускайте ```runcode.sh```, предварительно положив ```Test.txt``` в корень проекта ```../.``` После запуска вы можете использовать : -* ```../resources/report.tex``` - сгенерированный Tex файл -* ```../report.pdf``` - сгенерированный Pdf файл (Если вы согласились с установкой Tex) -* ```../test.txt``` - Тест (мы могли его генерировать) +* ```resources/report.tex``` - сгенерированный Tex файл +* ```report.pdf``` - сгенерированный Pdf файл (Если вы согласились с установкой Tex) +* ```test.txt``` - Тест (мы могли его генерировать) ## Windows (ReactOS) diff --git a/scripts/runcode.sh b/scripts/repl.sh similarity index 100% rename from scripts/runcode.sh rename to scripts/repl.sh diff --git a/scripts/run_integration.sh b/scripts/run_integration.sh new file mode 100755 index 00000000..0f35be50 --- /dev/null +++ b/scripts/run_integration.sh @@ -0,0 +1,22 @@ +#!/bin/bash +if [ "$EUID" -ne 0 ]; then + echo "Скрипт должен быть запущен с использованием sudo." + exit 1 +fi +BASEDIR=$(pwd) +for test_file in $BASEDIR/scripts/integrationTests/*; do + sudo rm -rf *report* *pdflatex* + echo "$test_file" + sudo $BASEDIR/build/apps/InterpreterApp/InterpreterApp $test_file + # Проверка наличия и непустоты файла rendered_report.pdf + if [ ! -s "rendered_report.pdf" ]; then + echo "Ошибка: Файл rendered_report.pdf отсутствует или пуст." + exit 1 + fi + + # Проверка наличия и непустоты файла report.pdf + if [ ! -s "report.pdf" ]; then + echo "Ошибка: Файл report.pdf отсутствует или пуст." + exit 1 + fi +done \ No newline at end of file