From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 643FF6ECE3; Fri, 1 Jul 2022 17:37:16 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 643FF6ECE3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1656686236; bh=0ffQpkwCepUi+KFslibhXE52Fx6wflO8Ret73ikV2gE=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=XMMswTA0t1esqQmWUZn2S+XFK+cOMfx6jWV0xX9aaO9+VB8KV6ZyFgRsxqQxTapPZ 93LSU3Jrb5eZ2yU223sdf8JQjHuQJjeE7zT2qLko+k3JwK/npzE6H1AS7HGYnHEa8p J74ra+32lsb0WVV9wrtpnGcBhTGPMoSJ8HRKDfyE= Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 75DAD6ECE3 for ; Fri, 1 Jul 2022 17:37:15 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 75DAD6ECE3 Received: by mail-lf1-f51.google.com with SMTP id i18so4205933lfu.8 for ; Fri, 01 Jul 2022 07:37:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EApD0OuY76oVKsDmqKORyWqYrCB8mRUJb9FRF01/dFQ=; b=3knNjx4ZIyAOaG1eWbjlUbnMFaLJ+KEycxAFjPrvUoK+yNx5kWkQiLU8uzBQDhf3Wk 6toWr4yNds07vP5puoYM4K55La6/ZeyZfJfR+NrvNdqMHQrPIAqAsNF2S+N7Lh2KQL5m YnR8a6HGPfOgQhBU/TElRXsTV2nDxcvrUiFaNIfc0VtZn/o4ko8q8HfekLefaKGH/uXe r7KA6FKHzZInhJuO7dt2zzxlF3SAIg4t0i2Qibbyx/xMeecg7mhNUu+RvXHZOK4f7cFx OaG4WpfUlcZfxXtQsCIVQItyhzN9kACpD4hdY7r21cGARfDF47qnMnRkWeGBnrX+L025 AdbA== X-Gm-Message-State: AJIora/OUkq56t+SAMgig4SUn4x8TZsRipoPA3JhIoJpVtHzmL1aW986 5rHz6IK2GEXMgXN8rvqX3QZTPfaodaI= X-Google-Smtp-Source: AGRyM1v80l43d3GqnEu0/NQcD8FdpjhX86fYWJiWb9tR2dCYd9KbN+TkMRxLzReUALgAKGdRkGBAQQ== X-Received: by 2002:a05:6512:3981:b0:478:54e2:7003 with SMTP id j1-20020a056512398100b0047854e27003mr9081508lfu.416.1656686234273; Fri, 01 Jul 2022 07:37:14 -0700 (PDT) Received: from localhost.localdomain ([178.176.76.174]) by smtp.gmail.com with ESMTPSA id z8-20020ac25de8000000b0047ac01fc644sm3652426lfq.44.2022.07.01.07.37.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 07:37:13 -0700 (PDT) X-Google-Original-From: Sergey Bronnikov To: tarantool-patches@dev.tarantool.org Date: Fri, 1 Jul 2022 17:36:50 +0300 Message-Id: <62acf609d9e1ea43d95cb27213e1b8f1331b57a7.1656685987.git.sergeyb@tarantool.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH] build: configure parallel jobs X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" lua-Harness and tarantool testsuites uses a prove(1) for running tests. prove(1) allows to run tests in parallel with option "--jobs" [1]. In CMake it is not possible to get a number of parallel jobs in CMake passed by user with option "-j", but it allows to pass a number of parallel jobs with environment variable CMAKE_BUILD_PARALLEL_LEVEL [2] on configuration phase. We use a value set by that environment variable and set it to a number of CPU threads when it was not specified by user. Number of CPU threads detected using builtin CMake function [3]. NOTE: CMAKE_BUILD_PARALLEL_LEVEL has been added in a version 3.12. 1. https://perldoc.perl.org/prove 2. https://cmake.org/cmake/help/latest/envvar/CMAKE_BUILD_PARALLEL_LEVEL.html 3. https://cmake.org/cmake/help/latest/module/ProcessorCount.html --- Branch: https://github.com/tarantool/luajit/tree/ligurio/prove-in-parallel CI: https://github.com/tarantool/luajit/commit/62acf609d9e1ea43d95cb27213e1b8f1331b57a7 test/CMakeLists.txt | 13 +++++++++++++ test/lua-Harness-tests/CMakeLists.txt | 1 + test/tarantool-tests/CMakeLists.txt | 1 + 3 files changed, 15 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ba25af54..fc4ffc51 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -43,6 +43,19 @@ endif() set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]") separate_arguments(LUAJIT_TEST_COMMAND) +set(CMAKE_BUILD_PARALLEL_LEVEL $ENV{CMAKE_BUILD_PARALLEL_LEVEL}) +if(NOT CMAKE_BUILD_PARALLEL_LEVEL) + include(ProcessorCount) + ProcessorCount(N) + # Function ProcessorCount() is guaranteed to return a positive integer (>=1) + # if it succeeds. It returns 0 if there's a problem determining the processor + # count. + if(NOT N EQUAL 0) + set(CMAKE_BUILD_PARALLEL_LEVEL ${N}) + endif() +endif() +message(STATUS "Using CMAKE_BUILD_PARALLEL_LEVEL: ${CMAKE_BUILD_PARALLEL_LEVEL}") + add_subdirectory(LuaJIT-tests) add_subdirectory(PUC-Rio-Lua-5.1-tests) add_subdirectory(lua-Harness-tests) diff --git a/test/lua-Harness-tests/CMakeLists.txt b/test/lua-Harness-tests/CMakeLists.txt index ec08a19b..12476171 100644 --- a/test/lua-Harness-tests/CMakeLists.txt +++ b/test/lua-Harness-tests/CMakeLists.txt @@ -28,6 +28,7 @@ add_custom_command(TARGET lua-Harness-tests LUA_PATH="${LUA_PATH}\;" ${PROVE} ${CMAKE_CURRENT_SOURCE_DIR} --exec '${LUAJIT_TEST_COMMAND} -l profile_luajit21' + --jobs ${CMAKE_BUILD_PARALLEL_LEVEL} ${LUA_TEST_FLAGS} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/test/tarantool-tests/CMakeLists.txt b/test/tarantool-tests/CMakeLists.txt index 5708822e..ecda2e63 100644 --- a/test/tarantool-tests/CMakeLists.txt +++ b/test/tarantool-tests/CMakeLists.txt @@ -136,6 +136,7 @@ add_custom_command(TARGET tarantool-tests ${PROVE} ${CMAKE_CURRENT_SOURCE_DIR} --exec 'env ${LUA_TEST_ENV_MORE} ${LUAJIT_TEST_COMMAND}' --ext ${LUA_TEST_SUFFIX} + --jobs ${CMAKE_BUILD_PARALLEL_LEVEL} ${LUA_TEST_FLAGS} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) -- 2.25.1