Skip to content

Commit 14fa76e

Browse files
committed
CMakeLists.txt, test.yml: make "run" target optional, continute to use in CI
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
1 parent 176619a commit 14fa76e

File tree

2 files changed

+51
-47
lines changed

2 files changed

+51
-47
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
- name: "Config perftools build"
7474
working-directory: "./perftools/source"
7575
run: |
76-
cmake -S . -B build -DOPENSSL_ROOT_DIR="$GITHUB_WORKSPACE/openssl" -Drun_add_version_dep:BOOL=OFF ${{ matrix.release.cmakeopts }}
76+
cmake -S . -B build -DOPENSSL_ROOT_DIR="$GITHUB_WORKSPACE/openssl" -Denable_run_target:BOOL=ON -Drun_add_version_dep:BOOL=OFF ${{ matrix.release.cmakeopts }}
7777
- name: "Build perftools"
7878
working-directory: "./perftools/source"
7979
run: |
@@ -157,7 +157,7 @@ jobs:
157157
- name: "Config perftools build"
158158
working-directory: "./perftools/source"
159159
run: |
160-
cmake -S . -B build -DOPENSSL_ROOT_DIR="$GITHUB_WORKSPACE/openssl" -Drun_add_version_dep:BOOL=OFF ${{ matrix.release.cmakeopts }}
160+
cmake -S . -B build -DOPENSSL_ROOT_DIR="$GITHUB_WORKSPACE/openssl" -Denable_run_target:BOOL=ON -Drun_add_version_dep:BOOL=OFF ${{ matrix.release.cmakeopts }}
161161
- name: "Build perftools"
162162
working-directory: "./perftools/source"
163163
run: |
@@ -262,7 +262,7 @@ jobs:
262262
shutdown_vm: false
263263
run: |
264264
cd perftools/source
265-
cmake -S . -B build -DOPENSSL_ROOT_DIR="$GITHUB_WORKSPACE/openssl" -Drun_add_version_dep:BOOL=OFF ${{ matrix.release.cmakeopts }}
265+
cmake -S . -B build -DOPENSSL_ROOT_DIR="$GITHUB_WORKSPACE/openssl" -Denable_run_target:BOOL=ON -Drun_add_version_dep:BOOL=OFF ${{ matrix.release.cmakeopts }}
266266
- name: "Build perftools"
267267
uses: "cross-platform-actions/action@fe0167d8082ac584754ef3ffb567fded22642c7d" #v0.27.0
268268
with:
@@ -358,7 +358,7 @@ jobs:
358358
- name: "Config perftools build"
359359
working-directory: ".\\perftools\\source"
360360
run: |
361-
cmake -S . -B .\build -DOPENSSL_ROOT_DIR="$env:GITHUB_WORKSPACE\openssl" -Drun_add_version_dep:BOOL=OFF ${{ matrix.release.cmakeopts }}
361+
cmake -S . -B .\build -DOPENSSL_ROOT_DIR="$env:GITHUB_WORKSPACE\openssl" -Denable_run_target:BOOL=ON -Drun_add_version_dep:BOOL=OFF ${{ matrix.release.cmakeopts }}
362362
- name: "Build perftools"
363363
working-directory: ".\\perftools\\source"
364364
run: |
@@ -435,7 +435,7 @@ jobs:
435435
- name: "Config perftools build"
436436
working-directory: "./perftools/source"
437437
run: |
438-
cmake -S . -B build -DOPENSSL_ROOT_DIR="$GITHUB_WORKSPACE/openssl" -Drun_add_version_dep:BOOL=OFF ${{ matrix.release.cmakeopts }}
438+
cmake -S . -B build -DOPENSSL_ROOT_DIR="$GITHUB_WORKSPACE/openssl" -Denable_run_target:BOOL=ON -Drun_add_version_dep:BOOL=OFF ${{ matrix.release.cmakeopts }}
439439
- name: "Build perftools"
440440
working-directory: "./perftools/source"
441441
run: |

source/CMakeLists.txt

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ target_link_libraries(evp_hash PRIVATE perf)
213213

214214
## Running tests
215215
# Options
216+
option(enable_run_target "Enable generation of run* targets")
217+
216218
set(run_tests evp_fetch
217219
evp_hash
218220
evp_setpeer
@@ -446,61 +448,63 @@ function(gen_run_taget _CMD _TEST)
446448
endfunction()
447449

448450
# run targets generation
449-
foreach(test IN LISTS run_tests)
450-
set(cmds "${test}")
451+
if (enable_run_target)
452+
foreach(test IN LISTS run_tests)
453+
set(cmds "${test}")
454+
455+
# test-specific options
456+
foreach(opt_name IN LISTS run_opts)
457+
set(opt "${${opt_name}}")
458+
list(GET opt 0 test_name)
459+
list(GET opt 1 test_opt)
460+
list(REMOVE_AT opt 0 1)
461+
462+
if(test IN_LIST test_name)
463+
set(new_cmds)
464+
foreach(cmd IN LISTS cmds)
465+
foreach(val IN LISTS opt)
466+
list(APPEND new_cmds "${cmd} ${test_opt} ${val}")
467+
endforeach()
468+
endforeach()
469+
set(cmds ${new_cmds})
470+
endif()
471+
endforeach()
451472

452-
# test-specific options
453-
foreach(opt_name IN LISTS run_opts)
454-
set(opt "${${opt_name}}")
455-
list(GET opt 0 test_name)
456-
list(GET opt 1 test_opt)
457-
list(REMOVE_AT opt 0 1)
473+
# terse
474+
set(new_cmds)
475+
foreach(cmd IN LISTS cmds)
476+
foreach(val IN LISTS run_terse)
477+
list(APPEND new_cmds "${cmd} ${val}")
478+
endforeach()
479+
endforeach()
480+
set(cmds ${new_cmds})
458481

459-
if(test IN_LIST test_name)
482+
# certdir
483+
if(test IN_LIST run_certdir_tests)
460484
set(new_cmds)
461485
foreach(cmd IN LISTS cmds)
462-
foreach(val IN LISTS opt)
463-
list(APPEND new_cmds "${cmd} ${test_opt} ${val}")
464-
endforeach()
486+
list(APPEND new_cmds "${cmd} ${run_certdir}")
465487
endforeach()
466488
set(cmds ${new_cmds})
467489
endif()
468-
endforeach()
469490

470-
# terse
471-
set(new_cmds)
472-
foreach(cmd IN LISTS cmds)
473-
foreach(val IN LISTS run_terse)
474-
list(APPEND new_cmds "${cmd} ${val}")
475-
endforeach()
476-
endforeach()
477-
set(cmds ${new_cmds})
478-
479-
# certdir
480-
if(test IN_LIST run_certdir_tests)
491+
# threads
481492
set(new_cmds)
482493
foreach(cmd IN LISTS cmds)
483-
list(APPEND new_cmds "${cmd} ${run_certdir}")
494+
foreach(val IN LISTS run_threads)
495+
list(APPEND new_cmds "${cmd} ${val}")
496+
endforeach()
484497
endforeach()
485498
set(cmds ${new_cmds})
486-
endif()
487499

488-
# threads
489-
set(new_cmds)
490-
foreach(cmd IN LISTS cmds)
491-
foreach(val IN LISTS run_threads)
492-
list(APPEND new_cmds "${cmd} ${val}")
500+
# Run targets
501+
foreach(cmd IN LISTS cmds)
502+
gen_run_taget("${cmd}" "${test}" VAR run_target_name)
503+
add_dependencies(run "${run_target_name}")
493504
endforeach()
494-
endforeach()
495-
set(cmds ${new_cmds})
496505

497-
# Run targets
498-
foreach(cmd IN LISTS cmds)
499-
gen_run_taget("${cmd}" "${test}" VAR run_target_name)
500-
add_dependencies(run "${run_target_name}")
506+
# Per-test version target
507+
gen_run_taget("${test} -V" "${test}" NAME "run-version-${test}")
508+
add_dependencies(run-version "run-version-${test}")
501509
endforeach()
502-
503-
# Per-test version target
504-
gen_run_taget("${test} -V" "${test}" NAME "run-version-${test}")
505-
add_dependencies(run-version "run-version-${test}")
506-
endforeach()
510+
endif()

0 commit comments

Comments
 (0)