Skip to content

Conversation

@esyr
Copy link
Member

@esyr esyr commented Oct 16, 2025

Introduce a run target, that executes all the test with different options. For now is used only for minimal sanity checking, that are test can be run and don't fail, but later can be extended to check the results for sanity as well, and the design has some provisions put in place to be useful for test data collection as well, for example.

@esyr esyr force-pushed the esyr/cmake-run branch 8 times, most recently from 67580ed to e693b26 Compare October 16, 2025 19:13
@esyr esyr changed the title Add cmake run targets and use it in PR CI Add cmake "run" target and use it in PR CI Oct 16, 2025
Copy link
Contributor

@jogme jogme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thank you!

@quarckster
Copy link
Contributor

Interesting that the only Windows on master didn't pass.

endforeach()
set(cmds ${new_cmds})
endif()
endforeach()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried it but make run does not respect or set (DY)LD_LIBRARY_PATH which should be fixed.

I would probably write custom target manually for each binary. The cmd options are much too different for a generic solution.

$ echo $DYLD_LIBRARY_PATH
/Users/npajkovsky/openssl/openssl
$ ll /Users/npajkovsky/openssl/openssl | grep ssl.4
-rwxr-xr-x     1 npajkovsky  staff   960K Oct 17 10:21 libssl.4.dylib
$ make run
[  2%] Built target perf
[  3%] Built target x509storeissuer
[  3%] Run x509storeissuer -t /Users/npajkovsky/openssl/openssl/test/certs 4
dyld[58574]: Library not loaded: /usr/local/lib/libssl.4.dylib
  Referenced from: <7C191CC0-3566-3B84-9EB4-9AB01FD44703> /Users/npajkovsky/openssl/perftools/source/x509storeissuer
  Reason: tried: '/usr/local/lib/libssl.4.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libssl.4.dylib' (no such file), '/usr/local/lib/libssl.4.dylib' (no such file)
make[3]: *** [CMakeFiles/run-x509storeissuer--t--U_sers-npajkovsky-openssl-openssl-test-certs-4] Abort trap: 6
make[2]: *** [CMakeFiles/run-x509storeissuer--t--U_sers-npajkovsky-openssl-openssl-test-certs-4.dir/all] Error 2
make[1]: *** [CMakeFiles/run.dir/rule] Error 2
make: *** [run] Error 2

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you exported the variable? But that's a valid point, that cmake doesn't do any provisions to supply the provided OPENSSL_ROOT_DIR to the executables being run, the relevant overrides should be added to the CI recipes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine on OpenBSD where I run cmake as follows:

cmake -S . -B ./build -DOPENSSL_CONFIG_MODE=1 -DCMAKE_PREFIX_PATH=/path/to/openssl.install
cmake --build build
cmake --build build -t run

The build is setup such linker adds RUNPATH to elf header. The RUNPATH is set to /path/to/openssl.install I will take a look at macos.

In my case the failure happens later due to missing/wrong path to testcert dirs.

[ 42%] Built target run-evp-setpeer--k-ec256--t-4
[ 42%] Built target handshake  
[ 42%] Run handshake -P -S 1048576 -t /test/certs 1            
40C0882EE20C0000:error:80000002:system library:file_ctrl:No such file or directory:crypto/bio/bss_file.c:288:calling fopen(/test/certs/servercert.pem, r)
40C0882EE20C0000:error:10080002:BIO routines:file_ctrl:system lib:crypto/bio/bss_file.c:291:                                                           
40C0882EE20C0000:error:0A080002:SSL routines:SSL_CTX_use_certificate_file:system lib:ssl/ssl_rsa.c:329:
/home/sashan/work.openssl/perftools/source/handshake.c:196: Failed to create SSL_CTX pair

My understanding is it is it expects CMAKE_PREFIX_PATH pointing to openssl sources but it got the path to custom installation. If I fix the CMAKE_PREFIX_PATH so it points to sources where custom openssl got installed from I get a different failure:

lifty$ make run
[  2%] Built target perf
[  3%] Built target writeread
[  3%] Run writeread -d -b 4096 /test/certs 4
Failed to create SSL_CTX pair
*** Error 1 in . (CMakeFiles/run-writeread--d--b-4096--test-certs-4.dir/build.make:71 'CMakeFiles/run-writeread--d--b-4096--test-certs-4': /...)
*** Error 2 in . (CMakeFiles/Makefile2:9133 'CMakeFiles/run-writeread--d--b-4096--test-certs-4.dir/all': make -s -f CMakeFiles/run-writeread...)
*** Error 2 in . (CMakeFiles/Makefile2:1125 'CMakeFiles/run.dir/rule': make -s -f CMakeFiles/Makefile2 CMakeFiles/run.dir/all)
*** Error 2 in /home/sashan/work.openssl/perftools/source/build (Makefile:306 'run': make -s -f CMakeFiles/Makefile2 run)

I understand the motivation to improve the CI experience. though I'm bit worried this makes the CMakeLists.txt bit too fancy to my taste. It was meant to be simple....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in ci runner it looks like the tool is doing the right thing. you may need to set DYLD_LIBRARY_PATH env. var explicitly in your shell when running cmake --build ... command, this may help.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of local runs with CMAKE_PREFIX_PATH being used, one can explicitly set run_certdir, cmake -S . -B ./build -DOPENSSL_CONFIG_MODE=1 -DCMAKE_PREFIX_PATH=/path/to/openssl.install -Drun_certdir=/path/to/test/certs or so.

Copy link
Contributor

@Sashan Sashan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea to improve CI tests. I just need more time to get familiar with cmake constructs which are used.

endforeach()
set(cmds ${new_cmds})
endif()
endforeach()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine on OpenBSD where I run cmake as follows:

cmake -S . -B ./build -DOPENSSL_CONFIG_MODE=1 -DCMAKE_PREFIX_PATH=/path/to/openssl.install
cmake --build build
cmake --build build -t run

The build is setup such linker adds RUNPATH to elf header. The RUNPATH is set to /path/to/openssl.install I will take a look at macos.

In my case the failure happens later due to missing/wrong path to testcert dirs.

[ 42%] Built target run-evp-setpeer--k-ec256--t-4
[ 42%] Built target handshake  
[ 42%] Run handshake -P -S 1048576 -t /test/certs 1            
40C0882EE20C0000:error:80000002:system library:file_ctrl:No such file or directory:crypto/bio/bss_file.c:288:calling fopen(/test/certs/servercert.pem, r)
40C0882EE20C0000:error:10080002:BIO routines:file_ctrl:system lib:crypto/bio/bss_file.c:291:                                                           
40C0882EE20C0000:error:0A080002:SSL routines:SSL_CTX_use_certificate_file:system lib:ssl/ssl_rsa.c:329:
/home/sashan/work.openssl/perftools/source/handshake.c:196: Failed to create SSL_CTX pair

My understanding is it is it expects CMAKE_PREFIX_PATH pointing to openssl sources but it got the path to custom installation. If I fix the CMAKE_PREFIX_PATH so it points to sources where custom openssl got installed from I get a different failure:

lifty$ make run
[  2%] Built target perf
[  3%] Built target writeread
[  3%] Run writeread -d -b 4096 /test/certs 4
Failed to create SSL_CTX pair
*** Error 1 in . (CMakeFiles/run-writeread--d--b-4096--test-certs-4.dir/build.make:71 'CMakeFiles/run-writeread--d--b-4096--test-certs-4': /...)
*** Error 2 in . (CMakeFiles/Makefile2:9133 'CMakeFiles/run-writeread--d--b-4096--test-certs-4.dir/all': make -s -f CMakeFiles/run-writeread...)
*** Error 2 in . (CMakeFiles/Makefile2:1125 'CMakeFiles/run.dir/rule': make -s -f CMakeFiles/Makefile2 CMakeFiles/run.dir/all)
*** Error 2 in /home/sashan/work.openssl/perftools/source/build (Makefile:306 'run': make -s -f CMakeFiles/Makefile2 run)

I understand the motivation to improve the CI experience. though I'm bit worried this makes the CMakeLists.txt bit too fancy to my taste. It was meant to be simple....

@Sashan Sashan force-pushed the esyr/cmake-run branch 2 times, most recently from a2d538e to bbddd22 Compare October 19, 2025 23:43
@Sashan Sashan moved this from New to Awaits review in Project Board Oct 20, 2025
@Sashan Sashan removed this from Project Board Oct 20, 2025
@Sashan Sashan moved this to Waiting Review in Development Board Oct 20, 2025
Copy link
Contributor

@Sashan Sashan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this useful. I let @esyr to polish the code (if needed) and re-submit for review once he will be happy with the code. thanks.

@vavroch2010 vavroch2010 moved this from Waiting Review to In Progress in Development Board Oct 21, 2025
esyr and others added 9 commits October 31, 2025 16:52
Add "run" target that runs all the tests with various options.

Co-Authored-by: Alexandr Nedvedicky <[email protected]>
Signed-off-by: Eugene Syromiatnikov <[email protected]>
These take time (especially on Windows) and we don't use them here anyway.

Signed-off-by: Eugene Syromiatnikov <[email protected]>
A helper function that prints version information, so far the version
of the OpenSSL library a program is run with.

Signed-off-by: Eugene Syromiatnikov <[email protected]>
When a test program is called with "-V" option, it prints version
information and exits.

Signed-off-by: Eugene Syromiatnikov <[email protected]>
Generate run-version-<test> target for each test from run_tests, make
it a dependency of run-version target. and, if run_add_version_dep
vesioble is set to ON (the default), set "run-version" as a dependency
of the "run" target.

Signed-off-by: Eugene Syromiatnikov <[email protected]>
…tage

To increase readability and catch incorrect linking issues early in the run.

Signed-off-by: Eugene Syromiatnikov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

5 participants