-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* coz: migrate to Conan v2 * coz: use is_apple_os() * coz: update * coz: fix test_package * coz: static build is not supported, mark as shared-library * coz: drop test_v1_package
- Loading branch information
Showing
4 changed files
with
79 additions
and
51 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package C) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
find_package(coz-profiler REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE coz::coz) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,40 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
from conan.tools.files import chdir | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self, build_type="RelWithDebInfo") # To work properly Coz tool requires debug information https://github.com/plasma-umass/coz | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if tools.cross_building(self.settings): | ||
if self.settings.build_type not in ["Debug", "RelWithDebInfo"]: | ||
self.output.info(f"Skipping coz test because {self.settings.build_type} " | ||
"build type does not contain debug information") | ||
return | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run("coz run --- " + bin_path, run_environment=True) | ||
print(open("profile.coz").read()) | ||
if self.settings.os == "Linux": | ||
perf_even_paranoid = int(open("/proc/sys/kernel/perf_event_paranoid").read()) | ||
is_root = os.geteuid() == 0 | ||
if perf_even_paranoid > 2 and not is_root: | ||
self.output.info("Skipping coz test because /proc/sys/kernel/perf_event_paranoid value " | ||
f"must be <= 2 (currently {perf_even_paranoid}) and not running as root") | ||
return | ||
if can_run(self): | ||
with chdir(self, self.cpp.build.bindir): | ||
self.run("coz run --- ./test_package", env="conanrun") | ||
print(open("profile.coz").read()) |