Skip to content

[benchmark] SR-4572 Remove jinja2 dependency from test harness generation #9193

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

Merged
merged 2 commits into from
May 11, 2017
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
3 changes: 1 addition & 2 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# -*- mode: cmake -*-
################################################################################
# WARNING: This file is automatically generated from templates and should not
# be directly modified. Instead, make changes to
# scripts/generate_harness/CMakeLists.txt_template and run
# be directly modified. Instead, make changes to CMakeLists.text.gyb and run
# scripts/generate_harness/generate_harness.py to regenerate this file.
################################################################################

Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,45 @@
# -*- mode: cmake -*-
% # Ignore the following warning. This _is_ the correct file to edit.
################################################################################
# WARNING: This file is automatically generated from templates and should not
# be directly modified. Instead, make changes to
# scripts/generate_harness/CMakeLists.txt_template and run
# be directly modified. Instead, make changes to CMakeLists.text.gyb and run
# scripts/generate_harness/generate_harness.py to regenerate this file.
################################################################################
%{
from gyb_benchmark_support import (
tests,
multisource_benches
)
}%

cmake_minimum_required(VERSION 2.8.12)

# Add path for custom CMake modules.
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
"$${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

include(AddSwiftBenchmarkSuite)

set(SWIFT_BENCH_MODULES
{% for test in tests %}
single-source/{{ test }}
{% endfor %}
% for test in tests:
single-source/${test}
% end
)

set(SWIFT_MULTISOURCE_BENCHES
{% for multisource_bench in multisource_benches %}
multi-source/{{ multisource_bench.name }}
{% endfor %}
% for multisource_bench in multisource_benches:
multi-source/${multisource_bench.name}
% end
)

{% for multisource_bench in multisource_benches %}
set({{ multisource_bench.name }}_sources
{% for file in multisource_bench.files %}
multi-source/{{ multisource_bench.name }}/{{ file }}
{% endfor %}
% for multisource_bench in multisource_benches:
set(${multisource_bench.name}_sources
% for file in multisource_bench.files:
multi-source/${multisource_bench.name}/${file}
% end
)

{% endfor %}
% end

set(BENCH_DRIVER_LIBRARY_MODULES
utils/DriverUtils
Expand Down Expand Up @@ -62,19 +68,19 @@ if(NOT SWIFT_EXEC)
endif()

if(NOT SWIFT_LIBRARY_PATH)
get_filename_component(tmp_dir "${SWIFT_EXEC}" DIRECTORY)
get_filename_component(tmp_dir "${tmp_dir}" DIRECTORY)
set(SWIFT_LIBRARY_PATH "${tmp_dir}/lib/swift")
get_filename_component(tmp_dir "$${SWIFT_EXEC}" DIRECTORY)
get_filename_component(tmp_dir "$${tmp_dir}" DIRECTORY)
set(SWIFT_LIBRARY_PATH "$${tmp_dir}/lib/swift")
endif()

# If the CMAKE_C_COMPILER is already clang, don't find it again,
# thus allowing the --host-cc build-script argument to work here.
get_filename_component(c_compiler ${CMAKE_C_COMPILER} NAME)
get_filename_component(c_compiler $${CMAKE_C_COMPILER} NAME)

if(${c_compiler} STREQUAL "clang")
set(CLANG_EXEC ${CMAKE_C_COMPILER})
if($${c_compiler} STREQUAL "clang")
set(CLANG_EXEC $${CMAKE_C_COMPILER})
else()
runcmd(COMMAND "xcrun" "-toolchain" "${SWIFT_DARWIN_XCRUN_TOOLCHAIN}" "-f" "clang"
runcmd(COMMAND "xcrun" "-toolchain" "$${SWIFT_DARWIN_XCRUN_TOOLCHAIN}" "-f" "clang"
VARIABLE CLANG_EXEC
ERROR "Unable to find Clang driver")
endif()
Expand All @@ -90,7 +96,7 @@ Available configurations: <Optlevel>_SINGLEFILE, <Optlevel>_MULTITHREADED")
# where "_<configuration>" is optional.
if(NOT SWIFT_OPTIMIZATION_LEVELS)
set(SWIFT_OPTIMIZATION_LEVELS "Onone" "O" "Ounchecked"
${SWIFT_EXTRA_BENCH_CONFIGS})
$${SWIFT_EXTRA_BENCH_CONFIGS})
endif()

set(SWIFT_BENCHMARK_NUM_O_ITERATIONS "" CACHE STRING
Expand Down Expand Up @@ -123,30 +129,30 @@ set(watchos_triple_platform "watchos")

set(sdks)
set(platforms)
foreach(platform ${ONLY_PLATFORMS})
foreach(platform $${ONLY_PLATFORMS})
execute_process(
COMMAND "xcrun" "--sdk" "${platform}" "--show-sdk-path"
OUTPUT_VARIABLE ${platform}_sdk
COMMAND "xcrun" "--sdk" "$${platform}" "--show-sdk-path"
OUTPUT_VARIABLE $${platform}_sdk
RESULT_VARIABLE result
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if("${result}" MATCHES "0")
list(APPEND sdks "${${platform}_sdk}")
list(APPEND platforms ${platform})
if("$${result}" MATCHES "0")
list(APPEND sdks "$${$${platform}_sdk}")
list(APPEND platforms $${platform})
endif()
endforeach()

message("--")
message("-- Swift Benchmark Suite:")
message("-- SWIFT_EXEC = ${SWIFT_EXEC}")
message("-- SWIFT_LIBRARY_PATH = ${SWIFT_LIBRARY_PATH}")
message("-- CLANG_EXEC = ${CLANG_EXEC}")
message("-- SWIFT_OPTIMIZATION_LEVELS = ${SWIFT_OPTIMIZATION_LEVELS}")
message("-- ONLY_PLATFORMS = ${ONLY_PLATFORMS}")
message("-- SWIFT_EXEC = $${SWIFT_EXEC}")
message("-- SWIFT_LIBRARY_PATH = $${SWIFT_LIBRARY_PATH}")
message("-- CLANG_EXEC = $${CLANG_EXEC}")
message("-- SWIFT_OPTIMIZATION_LEVELS = $${SWIFT_OPTIMIZATION_LEVELS}")
message("-- ONLY_PLATFORMS = $${ONLY_PLATFORMS}")

message("-- found platforms: ${platforms}")
message("-- found platforms: $${platforms}")
message("-- found sdks:")
foreach(sdk ${sdks})
message("-- ${sdk}")
foreach(sdk $${sdks})
message("-- $${sdk}")
endforeach()

set(executable_targets)
Expand All @@ -155,27 +161,26 @@ if(SWIFT_SDKS)
set(IS_SWIFT_BUILD true)
endif()

set(srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
set(srcdir "$${CMAKE_CURRENT_SOURCE_DIR}")

if(IS_SWIFT_BUILD)
get_filename_component(swift-bin-dir "${SWIFT_EXEC}" DIRECTORY)
get_filename_component(swift-bin-dir "$${SWIFT_EXEC}" DIRECTORY)
else()
set(swift-bin-dir "${CMAKE_BINARY_DIR}/bin")
set(swift-bin-dir "$${CMAKE_BINARY_DIR}/bin")
endif()

set(benchmark-bin-dir "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(benchmark-lib-dir "${CMAKE_CURRENT_BINARY_DIR}/lib")
set(benchmark-lib-swift-dir "${CMAKE_CURRENT_BINARY_DIR}/lib/swift")
set(benchmark-bin-dir "$${CMAKE_CURRENT_BINARY_DIR}/bin")
set(benchmark-lib-dir "$${CMAKE_CURRENT_BINARY_DIR}/lib")
set(benchmark-lib-swift-dir "$${CMAKE_CURRENT_BINARY_DIR}/lib/swift")

file(MAKE_DIRECTORY "${swift-bin-dir}")
file(MAKE_DIRECTORY "${benchmark-bin-dir}")
file(MAKE_DIRECTORY "${benchmark-lib-dir}")
file(MAKE_DIRECTORY "${benchmark-lib-swift-dir}")
file(MAKE_DIRECTORY "$${swift-bin-dir}")
file(MAKE_DIRECTORY "$${benchmark-bin-dir}")
file(MAKE_DIRECTORY "$${benchmark-lib-dir}")
file(MAKE_DIRECTORY "$${benchmark-lib-swift-dir}")

# Compile the perf test suite for each platform
foreach(platform ${platforms})
swift_benchmark_compile(PLATFORM ${platform})
foreach(platform $${platforms})
swift_benchmark_compile(PLATFORM $${platform})
endforeach()

add_subdirectory(scripts)

Loading