Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
andarut committed Dec 25, 2023
1 parent ee9de22 commit 490f68e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 64 deletions.
100 changes: 38 additions & 62 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ jobs:
strategy:
matrix:
include:
# - os: buster
# compiler: g++
# cpp: 17
# asan: off
# ubsan: off
# - os: focal
# compiler: clang++
# cpp: 17
# asan: off
# ubsan: on
# - os: focal
# compiler: g++-10
# cpp: 20
# asan: on
# ubsan: off
- os: buster
compiler: g++
cpp: 17
asan: off
ubsan: off
- os: focal
compiler: clang++
cpp: 17
asan: off
ubsan: on
- os: focal
compiler: g++-10
cpp: 20
asan: on
ubsan: off
- os: jammy
compiler: g++
cpp: 20
Expand Down Expand Up @@ -81,42 +81,38 @@ jobs:
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all"

- name: Show generated unicode utils
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"cat ${{env.kphp_root_dir}}/objs/generated/auto/common/unicode-utils-auto.h"

# - name: Run unit tests
# run: docker exec kphp-build-container-${{matrix.os}} bash -c
# "make -C ${{env.kphp_build_dir}} -j$(nproc) test"
- name: Run unit tests
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"make -C ${{env.kphp_build_dir}} -j$(nproc) test"

- name: Compile dummy PHP script
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"cd ${{env.kphp_build_dir}} && echo 'hello world' > demo.php && ${{env.kphp_root_dir}}/objs/bin/kphp2cpp --cxx ${{matrix.compiler}} demo.php && kphp_out/server -o --user kitten"

# - name: Polyfills composer install
# run: docker exec kphp-build-container-${{matrix.os}} bash -c
# "composer install -d ${{env.kphp_polyfills_dir}}"
- name: Polyfills composer install
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"composer install -d ${{env.kphp_polyfills_dir}}"

# - name: Run python tests
# id: python_tests
# continue-on-error: true
# run: docker exec kphp-build-container-${{matrix.os}} bash -c
# "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -n$(nproc) ${{env.kphp_root_dir}}/tests/python/'"
- name: Run python tests
id: python_tests
continue-on-error: true
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -n$(nproc) ${{env.kphp_root_dir}}/tests/python/'"

# - name: Prepare python tests artifacts
# if: steps.python_tests.outcome == 'failure'
# run: docker cp kphp-build-container-${{matrix.os}}:${{env.kphp_root_dir}}/tests/python/_tmp/ ${{runner.temp}} &&
# rm -rf ${{runner.temp}}/_tmp/*/working_dir
- name: Prepare python tests artifacts
if: steps.python_tests.outcome == 'failure'
run: docker cp kphp-build-container-${{matrix.os}}:${{env.kphp_root_dir}}/tests/python/_tmp/ ${{runner.temp}} &&
rm -rf ${{runner.temp}}/_tmp/*/working_dir

# - name: Upload python tests artifacts
# uses: actions/upload-artifact@v3
# if: steps.python_tests.outcome == 'failure'
# with:
# path: ${{runner.temp}}/_tmp/
- name: Upload python tests artifacts
uses: actions/upload-artifact@v3
if: steps.python_tests.outcome == 'failure'
with:
path: ${{runner.temp}}/_tmp/

# - name: Fail pipeline if python tests failed
# if: steps.python_tests.outcome == 'failure'
# run: exit 1
- name: Fail pipeline if python tests failed
if: steps.python_tests.outcome == 'failure'
run: exit 1

- name: Build deb package
run: docker exec kphp-build-container-${{matrix.os}} bash -c
Expand Down Expand Up @@ -198,26 +194,6 @@ jobs:
# - name: Build all
# run: make -C ${{runner.workspace}}/build -j$(nproc) all

# # because of https://github.com/orgs/Homebrew/discussions/4612
# - name: Check Environment
# run: |
# export HOMEBREW_NO_INSTALL_FROM_API=0
# brew untap --force homebrew/cask

# - name: Setup Environment
# run: |
# brew tap shivammathur/php
# brew update
# brew install re2c cmake coreutils openssl libiconv re2 pcre yaml-cpp zstd googletest shivammathur/php/php@7.4 python@3.12
# brew link --overwrite --force shivammathur/php/php@7.4
# /usr/local/Frameworks/Python.framework/Versions/3.12/bin/python3.12 -m pip install --upgrade pip --break-system-packages && /usr/local/Frameworks/Python.framework/Versions/3.12/bin/pip3 install jsonschema install --break-system-packages jsonschema

# - name: Run cmake
# run: cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DDOWNLOAD_MISSING_LIBRARIES=On -S $GITHUB_WORKSPACE -B ${{runner.workspace}}/build

# - name: Build all
# run: make -C ${{runner.workspace}}/build -j$(nproc) all

# - name: Run unit tests
# run: make -C ${{runner.workspace}}/build -j$(nproc) test

Expand Down
2 changes: 1 addition & 1 deletion compiler/compiler-settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ void CompilerSettings::init() {
ss << " -iquote" << kphp_src_path.get()
<< " -iquote " << kphp_src_path.get() << "objs/generated/auto/runtime";
ss << " -Wall -fwrapv -Wno-parentheses -Wno-trigraphs";
ss << " -fno-strict-aliasing -fno-omit-frame-pointer -fno-lto";
ss << " -fno-strict-aliasing -fno-omit-frame-pointer";
#ifdef __x86_64__
ss << " -march=sandybridge";
#elif __aarch64__
Expand Down
2 changes: 1 addition & 1 deletion compiler/kphp2cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ std::string get_default_extra_cxxflags() noexcept {
}

std::string get_default_extra_ldflags() noexcept {
std::string flags{"-L${KPHP_PATH}/objs/flex -ggdb"};
std::string flags{"-L${KPHP_PATH}/objs/flex -ggdb -fno-lto"};
#ifdef KPHP_HAS_NO_PIE
flags += " " KPHP_HAS_NO_PIE;
#endif
Expand Down

0 comments on commit 490f68e

Please sign in to comment.