From 10502bce28dff148c80db556392943e5d9912074 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 15 Jan 2019 05:14:30 +0100 Subject: [PATCH 1/2] 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. --- test/parallel/test-cli-node-print-help.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-cli-node-print-help.js b/test/parallel/test-cli-node-print-help.js index 3f9354b89cdb71..2dde1c1b5ebbba 100644 --- a/test/parallel/test-cli-node-print-help.js +++ b/test/parallel/test-cli-node-print-help.js @@ -1,3 +1,4 @@ +// Flags: --expose-internals 'use strict'; const common = require('../common'); @@ -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; @@ -21,7 +24,7 @@ function startPrintHelpTest() { function validateNodePrintHelp() { const config = process.config; const HAVE_OPENSSL = common.hasCrypto; - const NODE_FIPS_MODE = common.hasFipsCrypto; + const NODE_FIPS_MODE = fipsMode; const NODE_HAVE_I18N_SUPPORT = common.hasIntl; const HAVE_INSPECTOR = config.variables.v8_enable_inspector === 1; From 2bed534cd7951920825f5f542a0e2bc0a10517f7 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 15 Jan 2019 08:08:09 +0100 Subject: [PATCH 2/2] squash!: remove NODE_FIPS_MODE constant --- test/parallel/test-cli-node-print-help.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/parallel/test-cli-node-print-help.js b/test/parallel/test-cli-node-print-help.js index 2dde1c1b5ebbba..433a95faf20542 100644 --- a/test/parallel/test-cli-node-print-help.js +++ b/test/parallel/test-cli-node-print-help.js @@ -24,7 +24,6 @@ function startPrintHelpTest() { function validateNodePrintHelp() { const config = process.config; const HAVE_OPENSSL = common.hasCrypto; - const NODE_FIPS_MODE = fipsMode; const NODE_HAVE_I18N_SUPPORT = common.hasIntl; const HAVE_INSPECTOR = config.variables.v8_enable_inspector === 1; @@ -32,7 +31,7 @@ function validateNodePrintHelp() { { 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' ] },