[PATCH xrandr-utils 3/4] Add an A/B test comparing our xrandr's output with the installed xrandr

Bryce Harrington bryce at canonical.com
Wed Feb 15 16:10:42 PST 2012


Signed-off-by: Bryce Harrington <bryce at canonical.com>
---
 examples/before_and_after.sh |   23 +++++++++++++++++++++++
 examples/xrandr.c            |    5 ++++-
 2 files changed, 27 insertions(+), 1 deletions(-)
 create mode 100755 examples/before_and_after.sh

diff --git a/examples/before_and_after.sh b/examples/before_and_after.sh
new file mode 100755
index 0000000..1ec3e73
--- /dev/null
+++ b/examples/before_and_after.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+export DISPLAY=:0
+
+compare_str() {
+    echo -n "${1}: "
+    if [ "${2}" = "${3}" ]; then
+        echo "PASS"
+    else
+        echo "FAIL"
+    fi
+}
+    
+
+compare_str "version" "$(xrandr --version)" "$(./xrandr --version)"
+
+compare_str "help" "$(xrandr --help 2>&1)" "$(./xrandr --help 2>&1)"
+
+compare_str "basic status" "$(xrandr)" "$(./xrandr)"
+
+compare_str "verbose status" "$(xrandr --verbose)" "$(./xrandr --verbose)"
+
+
diff --git a/examples/xrandr.c b/examples/xrandr.c
index e7c2295..7ddddb4 100644
--- a/examples/xrandr.c
+++ b/examples/xrandr.c
@@ -41,6 +41,9 @@
 #include "config.h"
 #include "XrandrUtils.h"
 
+/* #define XRANDR_VERSION VERSION */
+#define XRANDR_VERSION "1.3.5"
+
 static char	*program_name;
 static Display	*dpy;
 static Window	root;
@@ -2602,7 +2605,7 @@ main (int argc, char **argv)
 	    query_1 = True;
     }
     if (version)
-	printf("xrandr program version       " VERSION "\n");
+	printf("xrandr program version       " XRANDR_VERSION "\n");
 
     dpy = XOpenDisplay (display_name);
 
-- 
1.7.9



More information about the xorg-devel mailing list