Subject: [Instant-dev] Patch for test scripts

From: "Johannes Ring" <[email-masked]>
Date: Mon, 29 Dec 2008 10:20:54 +0100 (CET)

Hi,

Please apply the attached patch which replaces the shell scripts under the
'tests' folder (run_tests.sh, rerun_tests.sh, and clean.sh) with
equivalent Python scripts for better cross-platform compatibility.

Johannes

# HG changeset patch
# User Johannes Ring <[email-masked]>
# Date 1230541778 -3600
# Node ID 4df47c27389b801d3b7dc645c1cf6ef4a677d203
# Parent  da24a909c44d76d1011628e410947f31641b230b
Replaced sh test scripts with Python scripts for better cross-platform compatibility.

diff -r da24a909c44d -r 4df47c27389b tests/clean.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/clean.py	Mon Dec 29 10:09:38 2008 +0100
@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+
+import glob, shutil
+
+for d in glob.glob("test*cache") + glob.glob("*ext"):
+    shutil.rmtree(d)
diff -r da24a909c44d -r 4df47c27389b tests/clean.sh
--- a/tests/clean.sh	Mon Nov 17 11:38:00 2008 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-#!/bin/bash
-rm -rf test*cache
-rm -rf *ext
diff -r da24a909c44d -r 4df47c27389b tests/rerun_tests.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/rerun_tests.py	Mon Dec 29 10:09:38 2008 +0100
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+import os, sys, glob
+
+print "Not cleaning local test cache before tests."
+
+failed_tests = []
+for f in glob.glob("test*.py"):
+   print "Running test", f
+   failure = os.system("python " + f)
+   if failure:
+       failed_tests.append(f)
+
+if failed_tests:
+    print "\nThe following tests failed:"
+    for f in failed_tests:
+        print f
+    sys.exit(len(failed_tests1))
diff -r da24a909c44d -r 4df47c27389b tests/rerun_tests.sh
--- a/tests/rerun_tests.sh	Mon Nov 17 11:38:00 2008 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-#!/bin/sh 
-
-echo Not cleaning local test cache before tests.
-rm -f failed_tests
-
-for file in test*.py; do
-   echo "Running test $file ";
-   python $file;
-   if [ $? != 0 ]; then
-     echo $file >> failed_tests
-   fi
-done
-
-echo
-echo The following tests failed:
-cat failed_tests
-
diff -r da24a909c44d -r 4df47c27389b tests/run_tests.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/run_tests.py	Mon Dec 29 10:09:38 2008 +0100
@@ -0,0 +1,19 @@
+#!/usr/bin/env python 
+
+import os, sys, glob, shutil
+
+print "Cleaning local test cache before tests."
+os.system("python clean.py")
+
+failed_tests = []
+for f in glob.glob("test*.py"):
+    print "Running test", f
+    failure = os.system("python " + f)
+    if failure:
+        failed_tests.append(f)
+
+if failed_tests:
+    print "\nThe following tests failed:"
+    for f in failed_tests:
+        print f
+    sys.exit(len(failed_tests1))
diff -r da24a909c44d -r 4df47c27389b tests/run_tests.sh
--- a/tests/run_tests.sh	Mon Nov 17 11:38:00 2008 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-#!/bin/sh 
-
-echo Cleaning local test cache before tests.
-./clean.sh
-
-rm -f failed_tests
-
-for file in test*.py; do
-   echo "Running test $file ";
-   python $file;
-   if [ $? != 0 ]; then
-     echo $file >> failed_tests
-   fi
-done
-
-if [ -f failed_tests ]; then  
-  echo
-  echo The following tests failed:
-  cat failed_tests
-  exit 1
-fi
-exit 0

---

From: "Johannes Ring" <[email-masked]>
Date: Mon, 29 Dec 2008 12:32:43 +0100 (CET)

Hi,

a tiny bug managed to sneak into the last patch. Sorry about that.
Attached is a new patch that fixes this.

Johannes

On Mon, December 29, 2008 10:20, Johannes Ring wrote:
> Johannes_______________________________________________
> Instant-dev mailing list
> [email-masked]
> http://fenics.org/mailman/listinfo/instant-dev
>
# HG changeset patch
# User Johannes Ring <[email-masked]>
# Date 1230549939 -3600
# Node ID 82140b9de5013141b02f34feef4e1058553f1452
# Parent  e74cca4309e1a850b7650f16c17f5b8591b83117
Minor fix in test script.

diff -r e74cca4309e1 -r 82140b9de501 tests/rerun_tests.py
--- a/tests/rerun_tests.py	Mon Dec 29 10:09:38 2008 +0100
+++ b/tests/rerun_tests.py	Mon Dec 29 12:25:39 2008 +0100
@@ -15,4 +15,4 @@
     print "\nThe following tests failed:"
     for f in failed_tests:
         print f
-    sys.exit(len(failed_tests1))
+    sys.exit(len(failed_tests))
diff -r e74cca4309e1 -r 82140b9de501 tests/run_tests.py
--- a/tests/run_tests.py	Mon Dec 29 10:09:38 2008 +0100
+++ b/tests/run_tests.py	Mon Dec 29 12:25:39 2008 +0100
@@ -16,4 +16,4 @@
     print "\nThe following tests failed:"
     for f in failed_tests:
         print f
-    sys.exit(len(failed_tests1))
+    sys.exit(len(failed_tests))

---

From: Ilmar Wilbers <[email-masked]>
Date: Mon, 29 Dec 2008 13:07:05 +0100

The patch is failing. Could you send a patch building on the patched 
revision from earlier instead of on its parent?

ilmar

Johannes Ring wrote:
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Instant-dev mailing list
>> [email-masked]

---

From: "Johannes Ring" <[email-masked]>
Date: Mon, 29 Dec 2008 13:14:15 +0100 (CET)

Are you sure? I have no problems applying the patch on a fresh hg clone of
Instant.

Johannes

---

From: Ilmar Wilbers <[email-masked]>
Date: Mon, 29 Dec 2008 13:18:33 +0100

Are you sure you didn't send the same patch twice? They had the exact 
same name so I had to overwrite the first one.

ilmar

---

From: Ilmar Wilbers <[email-masked]>
Date: Mon, 29 Dec 2008 13:20:00 +0100

My bad, I must have done something weird, it should be OK now.

ilmar

---

From: "Johannes Ring" <[email-masked]>
Date: Mon, 29 Dec 2008 13:20:50 +0100 (CET)

Good!

Johannes

On Mon, December 29, 2008 13:20, Ilmar Wilbers wrote:
>>>>> Please apply the attached patch which replaces the shell scripts
>>>>> under
>>>>> the