Skip to content

Commit

Permalink
CI: update .gitignore, enable UTs on darwin
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeny Malygin <[email protected]>
  • Loading branch information
678098 committed Jun 21, 2024
1 parent 3c380f3 commit aa647a4
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v4
- name: Get dependencies hash
id: get-hash
run: echo "deps_hash=`cat blazingmq/docker/build_deps.sh | shasum`" >> $GITHUB_OUTPUT
run: echo "deps_hash=`cat ${{ github.workspace }}/docker/build_deps.sh | shasum`" >> $GITHUB_OUTPUT
- name: Cache lookup
uses: actions/cache/restore@v4
id: cache-lookup
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
run: |
mkdir -p deps
cd deps
../docker/build_deps.sh
${{ github.workspace }}/docker/build_deps.sh
- name: Cache save
if: steps.cache-lookup.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
Expand All @@ -66,7 +66,7 @@ jobs:
- uses: actions/checkout@v4
- name: Get dependencies hash
id: get-hash
run: echo "deps_hash=`cat blazingmq/docker/build_deps.sh | shasum`" >> $GITHUB_OUTPUT
run: echo "deps_hash=`cat ${{ github.workspace }}/docker/build_deps.sh | shasum`" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v4
with:
path: deps
Expand All @@ -89,7 +89,7 @@ jobs:
libz-dev
- name: Install cached non packaged dependencies
working-directory: deps
run: ../docker/build_deps.sh
run: ${{ github.workspace }}/docker/build_deps.sh
- name: Build BlazingMQ
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/opt/bb/lib64/pkgconfig
Expand All @@ -104,9 +104,8 @@ jobs:
-DCMAKE_INSTALL_LIBDIR=lib64
cmake --build build/blazingmq --parallel 8 --target all all.t
- name: Run C++ Unit Tests
run: |
cd ${{ github.workspace }}/build/blazingmq
ctest -E mwcsys_executil.t --output-on-failure
working-directory: ${{ github.workspace }}/build/blazingmq
run: ctest --output-on-failure
- name: Clean-up build directories before caching
run: |
find . -name "*.o" -type f -delete
Expand Down Expand Up @@ -218,9 +217,18 @@ jobs:
bison \
flex \
google-benchmark
ifconfig
- name: Build BlazingMQ
run: bin/build-darwin.sh

- name: Build & Run C++ Unit Tests
working-directory: ${{ github.workspace }}/build/blazingmq
run: |
SELF_HOST_ADDRESS="127.0.0.1 $(hostname)"
sudo bash -c \"echo \\\"$SELF_HOST_ADDRESS\\\" >> /etc/hosts\"
make -j16 all.t
ctest --output-on-failure
build_and_test_bmqprometheus_plugin:
name: "Build Prometheus plugin [ubuntu]"
runs-on: ubuntu-latest
Expand Down
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,14 @@ settings.json
.pytest_cache/
.cache/
.venv/

# Symlink from 'src/applications/bmqbrkr/run'
src/applications/bmqbrkr/etc/etc

# 'sim_cpp11_features.pl' backups
src/groups/mwc/mwcex/mwcex_bindutil.h.bak
src/groups/mwc/mwcex/mwcex_future.h.bak
src/groups/mwc/mwcex/mwcex_promise.h.bak
src/groups/mwc/mwcu/mwcu_noop.h.bak
src/groups/mwc/mwcu/mwcu_objectplaceholder.h.bak
src/groups/mwc/mwcu/mwcu_operationchain.h.bak
5 changes: 4 additions & 1 deletion src/groups/mwc/mwcsys/mwcsys_executil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,11 @@ int ExecUtil::execute(bsl::string* output, const char* command)
output->assign(cmdOutput.str().data(), cmdOutput.str().length());

// Close the pipe, and retrieve the rc code of execution of the command.
int rc = pclose(pipe);
const int rc = pclose(pipe);
if (rc != 0) {
if (WIFSIGNALED(rc)) {
return rc_COMMAND_FAILURE; // RETURN
}
if (WIFEXITED(rc)) {
// Process normally exited with an 'exit', extract the lower 8 bits
// return value.
Expand Down
7 changes: 6 additions & 1 deletion src/groups/mwc/mwcsys/mwcsys_executil.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static void test2_executeSystemFailure()
//
// Plan:
// - Execute a suicidal command that terminates by sending itself a
// SIGINT.
// SIGKILL.
// - Use 'setrlimit()' [http://linux.die.net/man/2/setrlimit] to change
// the maximum number of file descriptor for the current process, so
// that the command will fail to execute.
Expand All @@ -137,6 +137,11 @@ static void test2_executeSystemFailure()
"python3.8 -c 'import os,signal; "
"os.kill(os.getpid(), signal.SIGKILL)'");
#else
rc = mwcsys::ExecUtil::execute(&output, "python3 --version");
ASSERT_EQ_D("'python3 --version' exec failed, python3 might be missing",
rc,
0);

rc = mwcsys::ExecUtil::execute(&output,
"python3 -c 'import os,signal; "
"os.kill(os.getpid(), signal.SIGKILL)'");
Expand Down

0 comments on commit aa647a4

Please sign in to comment.