Skip to content

Commit

Permalink
test: use fipsMode instead of common.hasFipsCrypto
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
danbev authored and MylesBorins committed May 16, 2019
1 parent 48482b0 commit d5316e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/parallel/test-cli-node-print-help.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Flags: --expose-internals
'use strict';

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

const assert = require('assert');
const { exec } = require('child_process');
const { internalBinding } = require('internal/test/binding');
const { fipsMode } = internalBinding('config');
let stdOut;


Expand All @@ -21,15 +24,14 @@ function startPrintHelpTest() {
function validateNodePrintHelp() {
const config = process.config;
const HAVE_OPENSSL = common.hasCrypto;
const NODE_FIPS_MODE = common.hasFipsCrypto;
const NODE_HAVE_I18N_SUPPORT = common.hasIntl;
const HAVE_INSPECTOR = config.variables.v8_enable_inspector === 1;

const cliHelpOptions = [
{ compileConstant: HAVE_OPENSSL,
flags: [ '--openssl-config=...', '--tls-cipher-list=...',
'--use-bundled-ca', '--use-openssl-ca' ] },
{ compileConstant: NODE_FIPS_MODE,
{ compileConstant: fipsMode,
flags: [ '--enable-fips', '--force-fips' ] },
{ compileConstant: NODE_HAVE_I18N_SUPPORT,
flags: [ '--icu-data-dir=...', 'NODE_ICU_DATA' ] },
Expand Down

0 comments on commit d5316e0

Please sign in to comment.