From eb76099e924b787ddc026441d87f77871ead9884 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Tue, 13 Feb 2018 17:21:37 -0600 Subject: [PATCH 1/2] Low: libcrmcommon: use /tmp when creating temporary XML file ... instead of CRM_STATE_DIR, which may not be usable from an ordinary user's account, thus generating incorrect CLI regression test output when run from a checkout. --- lib/common/schemas.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/common/schemas.c b/lib/common/schemas.c index b529ff5..7e76af3 100644 --- a/lib/common/schemas.c +++ b/lib/common/schemas.c @@ -625,9 +625,13 @@ validate_xml_verbose(xmlNode *xml_blob) xmlDoc *doc = NULL; xmlNode *xml = NULL; gboolean rc = FALSE; - char *filename = strdup(CRM_STATE_DIR "/cib-invalid.XXXXXX"); + const char *tmpdir = getenv("TMPDIR"); + char *filename = NULL; - CRM_CHECK(filename != NULL, return FALSE); + if ((tmpdir == NULL) || (*tmpdir != '/')) { + tmpdir = "/tmp"; + } + filename = crm_strdup_printf("%s/cib-invalid.XXXXXX", tmpdir); umask(S_IWGRP | S_IWOTH | S_IROTH); fd = mkstemp(filename); -- 1.8.3.1 From 48c9a80a7c3a621bd606ffcc14ae8a86072e41e0 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Tue, 13 Feb 2018 17:24:04 -0600 Subject: [PATCH 2/2] Test: tools: update regression test with correct output Verbose XML wasn't been shown from an ordinary user's checkout previously due to a bug that has since been fixed. --- tools/regression.validity.exp | 46 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tools/regression.validity.exp b/tools/regression.validity.exp index 7474746..7557454 100644 --- a/tools/regression.validity.exp +++ b/tools/regression.validity.exp @@ -3,6 +3,21 @@ Setting up shadow instance A new shadow instance was created. To begin using it paste the following into your shell: CIB_shadow=tools-regression ; export CIB_shadow =#=#=#= Begin test: Try to make resulting CIB invalid (enum violation) =#=#=#= + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 Call failed: Update does not conform to the configured schema =#=#=#= Current cib after: Try to make resulting CIB invalid (enum violation) =#=#=#= @@ -78,6 +93,21 @@ Your current configuration pacemaker-1.2 could not validate with any schema in r =#=#=#= End test: Run crm_simulate with invalid CIB (enum violation) - Required key not available (126) =#=#=#= * Passed: crm_simulate - Run crm_simulate with invalid CIB (enum violation) =#=#=#= Begin test: Try to make resulting CIB invalid (unrecognized validate-with) =#=#=#= + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 Call failed: Update does not conform to the configured schema =#=#=#= Current cib after: Try to make resulting CIB invalid (unrecognized validate-with) =#=#=#= @@ -161,6 +191,22 @@ Your current configuration pacemaker-9999.0 could not validate with any schema i =#=#=#= End test: Run crm_simulate with invalid CIB (unrecognized validate-with) - Required key not available (126) =#=#=#= * Passed: crm_simulate - Run crm_simulate with invalid CIB (unrecognized validate-with) =#=#=#= Begin test: Try to make resulting CIB invalid, but possibly recoverable (valid with X.Y+1) =#=#=#= + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 Call failed: Update does not conform to the configured schema =#=#=#= Current cib after: Try to make resulting CIB invalid, but possibly recoverable (valid with X.Y+1) =#=#=#= -- 1.8.3.1