Skip to content

Commit

Permalink
Merge pull request #5843 from janekmi/workflow-main-clang-format
Browse files Browse the repository at this point in the history
common: install clang-format for cstyle purposes
  • Loading branch information
janekmi authored Aug 7, 2023
2 parents 7a25ac3 + 64c2156 commit 99ab606
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: sudo pip install flake8
run: |
sudo pip install flake8
sudo apt-get install clang-format-14
- name: Check licenses
env:
Expand All @@ -37,6 +39,7 @@ jobs:

- name: Check style
env:
CSTYLE_FAIL_IF_CLANG_FORMAT_MISSING: 1
NDCTL_ENABLE: n # just to speed up the job
run: make -j$(nproc) cstyle

Expand Down
7 changes: 4 additions & 3 deletions src/benchmarks/pmembench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1215,9 +1215,10 @@ scale_up_min_exe_time(struct benchmark *bench, struct benchmark_args *args,
* scale up number of operations to get assumed minimal
* execution time
*/
args->n_ops_per_thread = (size_t)(
(double)args->n_ops_per_thread *
(min_exe_time + MIN_EXE_TIME_E) / total_res->total.min);
args->n_ops_per_thread =
(size_t)((double)args->n_ops_per_thread *
(min_exe_time + MIN_EXE_TIME_E) /
total_res->total.min);

results_free(total_res);
*total_results = results_alloc(args);
Expand Down
16 changes: 11 additions & 5 deletions utils/style_check.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2022, Intel Corporation
# Copyright 2016-2023, Intel Corporation
#
# utils/style_check.sh -- common style checking script
#
Expand Down Expand Up @@ -29,16 +29,22 @@ function usage() {
}

#
# require clang-format version 9.0
# require clang-format version 14.0
#
function check_clang_version() {
set +e
which ${clang_format_bin} &> /dev/null && ${clang_format_bin} --version |\
grep "version 9\.0"\
grep "version 14\.0"\
&> /dev/null
if [ $? -ne 0 ]; then
echo "SKIP: requires clang-format version 9.0"
exit 0
MSG="requires clang-format version==14.0"
if [ "x$CSTYLE_FAIL_IF_CLANG_FORMAT_MISSING" == "x1" ]; then
echo "FAIL: $MSG"
exit 1
else
echo "SKIP: $MSG"
exit 0
fi
fi
set -e
}
Expand Down

0 comments on commit 99ab606

Please sign in to comment.