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

common: install clang-format for cstyle purposes #5843

Merged
merged 3 commits into from
Aug 7, 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
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
fetch-depth: 50

- 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 @@ -26,6 +28,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
Loading