Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve debugging of failed tests during github workflows #455

Merged
merged 5 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
uses: actions/checkout@v2

- name: Build and run tests
if: "!contains(github.event.commits[0].message, '[debug]')"
env:
PDO_INTERPRETER: ${{ matrix.interpreter }}
run: |
Expand All @@ -30,3 +31,18 @@ jobs:
git checkout -b ci-test-branch
. build/common-config.sh
make -C docker test

- name: Build and run tests (DEBUG MODE)
if: "contains(github.event.commits[0].message, '[debug]')"
env:
PDO_INTERPRETER: ${{ matrix.interpreter }}
PDO_DEBUG_BUILD: 1
PDO_LOG_LEVEL: debug
run: |
# The creation of a dummy branch is necessary for the CI tests
# to work on PRs. Based on empirical results, in the absence of
# this command, CI tests work on the main branch and on local
# branches. However, they fail as a PR is created.
git checkout -b ci-test-branch
. build/common-config.sh
make -C docker test
22 changes: 15 additions & 7 deletions build/tests/unit-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,32 @@ check_python_version

PDO_LOG_LEVEL=${PDO_LOG_LEVEL:-info}

OUTFILE='/dev/null'
CMAKE_TEST_ARGS=''

if [ "${PDO_LOG_LEVEL,,}" == 'debug' ]; then
CMAKE_TEST_ARGS='ARGS=-V'
OUTFILE='/dev/stdout'
fi

# -----------------------------------------------------------------
yell run unit tests for python, common, contracts and eservice
# -----------------------------------------------------------------
say run unit tests for python package
cd ${PDO_SOURCE_ROOT}/python
try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} test > /dev/null

say run unit tests for common library
cd ${PDO_SOURCE_ROOT}/common/build
try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} test > /dev/null
try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} ${CMAKE_TEST_ARGS} test > ${OUTFILE}

say run unit tests for python package
cd ${PDO_SOURCE_ROOT}/python
try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} test > ${OUTFILE}

say run unit tests for eservice
cd ${PDO_SOURCE_ROOT}/eservice
try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} test > /dev/null
try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} test > ${OUTFILE}

say run unit tests for contracts
cd ${PDO_SOURCE_ROOT}/contracts
try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} test > /dev/null
try make TEST_LOG_LEVEL=${PDO_LOG_LEVEL} test > ${OUTFILE}

# -----------------------------------------------------------------
yell start tests without provisioning or enclave services
Expand Down
2 changes: 2 additions & 0 deletions docker/client_base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ services:
PDO_LEDGER_TYPE: ccf
PDO_HOSTNAME: ${PDO_HOSTNAME}
PDO_LEDGER_URL: ${PDO_LEDGER_URL}
PDO_LOG_LEVEL: ${PDO_LOG_LEVEL:-info}
PDO_DEBUG_BUILD: ${PDO_DEBUG_BUILD:-0}
depends_on:
- ccf_container
- services_container
Expand Down
3 changes: 3 additions & 0 deletions docker/pdo_client.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ ENV PDO_INTERPRETER=${PDO_INTERPRETER}
ARG WASM_MEM_CONFIG=MEDIUM
ENV WASM_MEM_CONFIG=${WASM_MEM_CONFIG}

ARG PDO_LOG_LEVEL=info
ENV PDO_LOG_LEVEL=${PDO_LOG_LEVEL}

# copy the source files into the image
WORKDIR /project/pdo
COPY --chown=${UNAME}:${UNAME} repository /project/pdo/src
Expand Down
3 changes: 3 additions & 0 deletions docker/pdo_services.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ ENV PDO_INTERPRETER=${PDO_INTERPRETER}
ARG WASM_MEM_CONFIG=MEDIUM
ENV WASM_MEM_CONFIG=${WASM_MEM_CONFIG}

ARG PDO_LOG_LEVEL=info
ENV PDO_LOG_LEVEL=${PDO_LOG_LEVEL}

# copy the source files into the image
WORKDIR /project/pdo
COPY --chown=${UNAME}:${UNAME} repository /project/pdo/src
Expand Down
11 changes: 6 additions & 5 deletions docker/pdo_services_base.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ FROM pdo_base
ARG UBUNTU_VERSION=20.04
ARG UBUNTU_NAME=focal

ARG SGX=2.21
ARG OPENSSL=3.0.10
ARG SGXSSL=3.0-rc2
ARG SGX=2.22
ARG OPENSSL=3.0.12
ARG SGXSSL=3.0_Rev1

ARG SGX_MODE SIM
ARG SGX_MODE=SIM
ENV SGX_MODE $SGX_MODE

RUN echo "deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu ${UBUNTU_NAME} main" >> /etc/apt/sources.list \
Expand Down Expand Up @@ -80,7 +80,8 @@ RUN . /opt/intel/sgxsdk/environment \
&& git clone --depth 1 --branch ${SGXSSL} 'https://github.com/intel/intel-sgx-ssl.git' \
&& wget -q -P /tmp/intel-sgx-ssl/openssl_source https://www.openssl.org/source/openssl-${OPENSSL}.tar.gz \
&& cd /tmp/intel-sgx-ssl/Linux \
&& bash -c "make SGX_MODE=SIM NO_THREADS=1 DESTDIR=/opt/intel/sgxssl VERBOSE=0 all &> /dev/null" \
&& if [ $SGX_MODE = SIM ] ; then SKIP_INTELCPU_CHECK=TRUE ; else SKIP_INTELCPU_CHECK=FALSE ; fi \
&& bash -c "make SKIP_INTELCPU_CHECK=$SKIP_INTELCPU_CHECK SGX_MODE=$SGX_MODE NO_THREADS=1 DESTDIR=/opt/intel/sgxssl VERBOSE=0 all &> /dev/null" \
&& make install \
&& make clean \
&& rm -rf /tmp/intel-sgx-ssl
Expand Down
2 changes: 2 additions & 0 deletions docker/services_base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ services:
PDO_LEDGER_TYPE: ccf
PDO_LEDGER_URL: ${PDO_LEDGER_URL}
SGX_MODE: ${SGX_MODE:-SIM}
PDO_LOG_LEVEL: ${PDO_LOG_LEVEL:-info}
PDO_DEBUG_BUILD: ${PDO_DEBUG_BUILD:-0}
container_name: services_container
network_mode: "host"
depends_on:
Expand Down
4 changes: 4 additions & 0 deletions docker/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ services:
args:
PDO_HOSTNAME: localhost
PDO_LEDGER_URL: http://localhost:6600
PDO_LOG_LEVEL: ${PDO_LOG_LEVEL:-info}
PDO_DEBUG_BUILD: ${PDO_DEBUG_BUILD:-0}
entrypoint: /project/pdo/tools/run_services_tests.sh

client_container:
build:
args:
PDO_HOSTNAME: localhost
PDO_LEDGER_URL: http://localhost:6600
PDO_LOG_LEVEL: ${PDO_LOG_LEVEL:-info}
PDO_DEBUG_BUILD: ${PDO_DEBUG_BUILD:-0}
entrypoint: /project/pdo/tools/run_client_tests.sh
Loading