Skip to content

Commit

Permalink
tests: disable parsing of system CA certificates in CLI tests
Browse files Browse the repository at this point in the history
On my Debian laptop, openssl_init() takes ~30ms to load the default CA
certificates serialized in PEM format, and the cost is added to each jj
invocation. This change saves 20s (of 50s) on my machine.

% wc -l /usr/lib/ssl/cert.pem
3517 /usr/lib/ssl/cert.pem
  • Loading branch information
yuja committed Oct 7, 2023
1 parent d94c325 commit 7f4fe22
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cli/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ impl TestEnvironment {
cmd.env("JJ_TIMESTAMP", timestamp.to_rfc3339());
cmd.env("JJ_OP_TIMESTAMP", timestamp.to_rfc3339());

// libgit2 always initializes OpenSSL, and it takes a few tens of milliseconds
// to load the system CA certificates in X509_load_cert_crl_file_ex(). As we
// don't use HTTPS in our tests, we can disable the cert loading to speed up the
// CLI tests. If we migrated to gitoxide, maybe we can remove this hack.
if cfg!(unix) {
cmd.env("SSL_CERT_FILE", "/dev/null");
}

if cfg!(all(windows, target_env = "gnu")) {
// MinGW executables cannot run without `mingw\bin` in the PATH (which we're
// clearing above), so we add it again here.
Expand Down

0 comments on commit 7f4fe22

Please sign in to comment.