Skip to content

Commit 4e52b07

Browse files
danbevaddaleax
authored andcommitted
test: use fipsMode instead of common.hasFipsCrypto
Currently, test-cli-node-print-help uses common.hasFipsCrypto to determine if the test should check for the existence of FIPS related options (--enable-fips, and --force-fips). The FIPS options are available when node has been compiled against an OpenSSL library with FIPS support in which case the test would verify that these options are available. But by using crypto.fips (which uses crypto.getFips()) this would only be checked when fips has been enabled, but these options are available regardless if FIPS is enabled or disabled. This commit updates the test to use fipsMode from config to determine if the FIPS options existence should be checked. PR-URL: #25510 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 338f456 commit 4e52b07

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/parallel/test-cli-node-print-help.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Flags: --expose-internals
12
'use strict';
23

34
const common = require('../common');
@@ -7,6 +8,8 @@ const common = require('../common');
78

89
const assert = require('assert');
910
const { exec } = require('child_process');
11+
const { internalBinding } = require('internal/test/binding');
12+
const { fipsMode } = internalBinding('config');
1013
let stdOut;
1114

1215

@@ -21,15 +24,14 @@ function startPrintHelpTest() {
2124
function validateNodePrintHelp() {
2225
const config = process.config;
2326
const HAVE_OPENSSL = common.hasCrypto;
24-
const NODE_FIPS_MODE = common.hasFipsCrypto;
2527
const NODE_HAVE_I18N_SUPPORT = common.hasIntl;
2628
const HAVE_INSPECTOR = config.variables.v8_enable_inspector === 1;
2729

2830
const cliHelpOptions = [
2931
{ compileConstant: HAVE_OPENSSL,
3032
flags: [ '--openssl-config=...', '--tls-cipher-list=...',
3133
'--use-bundled-ca', '--use-openssl-ca' ] },
32-
{ compileConstant: NODE_FIPS_MODE,
34+
{ compileConstant: fipsMode,
3335
flags: [ '--enable-fips', '--force-fips' ] },
3436
{ compileConstant: NODE_HAVE_I18N_SUPPORT,
3537
flags: [ '--icu-data-dir=...', 'NODE_ICU_DATA' ] },

0 commit comments

Comments
 (0)