Skip to content

Commit 5aa832c

Browse files
rosinLtchaikov
andcommitted
run-make-check: Enable ctest resource allocation
Co-authored-by: Kefu Chai <[email protected]> Signed-off-by: luo rixin <[email protected]>
1 parent a1f9b59 commit 5aa832c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Diff for: run-make-check.sh

+12-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ source src/script/run-make.sh
2222

2323
set -e
2424

25+
function gen_ctest_resource_file() {
26+
local file_name=$(mktemp /tmp/ctest-resource-XXXXXX)
27+
local max_cpuid=$(($(nproc) - 1))
28+
jq -n '$ARGS.positional | map({id:., slots:1}) | {cpus:.} | {version: {major:1, minor:0}, local:[.]}' \
29+
--args $(seq 0 $max_cpuid) > $file_name
30+
echo "$file_name"
31+
}
32+
2533
function run() {
2634
# to prevent OSD EMFILE death on tests, make sure ulimit >= 1024
2735
$DRY_RUN ulimit -n $(ulimit -Hn)
@@ -43,14 +51,16 @@ function run() {
4351
fi
4452

4553
CHECK_MAKEOPTS=${CHECK_MAKEOPTS:-$DEFAULT_MAKEOPTS}
54+
CTEST_RESOURCE_FILE=$(gen_ctest_resource_file)
55+
CHECK_MAKEOPTS+=" --resource-spec-file ${CTEST_RESOURCE_FILE}"
4656
if in_jenkins; then
4757
if ! ctest $CHECK_MAKEOPTS --no-compress-output --output-on-failure --test-output-size-failed 1024000 -T Test; then
4858
# do not return failure, as the jenkins publisher will take care of this
49-
rm -fr ${TMPDIR:-/tmp}/ceph-asok.*
59+
rm -fr ${TMPDIR:-/tmp}/ceph-asok.* ${CTEST_RESOURCE_FILE}
5060
fi
5161
else
5262
if ! $DRY_RUN ctest $CHECK_MAKEOPTS --output-on-failure; then
53-
rm -fr ${TMPDIR:-/tmp}/ceph-asok.*
63+
rm -fr ${TMPDIR:-/tmp}/ceph-asok.* ${CTEST_RESOURCE_FILE}
5464
return 1
5565
fi
5666
fi

0 commit comments

Comments
 (0)