Blame SOURCES/011-regression-tests.patch

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