Blame SOURCES/011-regression-tests.patch

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