diff mbox

hwsim tests: pass commit as an argument

Message ID 1383155683-7851-1-git-send-email-johannes@sipsolutions.net
State Accepted
Headers show

Commit Message

Johannes Berg Oct. 30, 2013, 5:54 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

Rather than saving the current commit to a file, pass it
as an argument to run-tests.py.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
---
 tests/hwsim/run-all.sh   |  2 +-
 tests/hwsim/run-tests.py | 14 ++++----------
 tests/hwsim/start.sh     |  1 -
 3 files changed, 5 insertions(+), 12 deletions(-)

Comments

Jouni Malinen Oct. 31, 2013, 9:21 a.m. UTC | #1
On Wed, Oct 30, 2013 at 06:54:43PM +0100, Johannes Berg wrote:
> Rather than saving the current commit to a file, pass it
> as an argument to run-tests.py.

Thanks, applied this and rest of the pending tests/hwsim changes:

Johannes Berg (11):
      hwsim tests: Pass commit as an argument
      hwsim tests: Pass run-all arguments on
      hostapd: Add -T Linux tracing option
      hwsim tests: Allow run-tests.py to start tracing
      hwsim tests: Move logging into timestamped subdirectory
      hwsim tests: Pass --logdir to run-tests.py
      hwsim tests: Allow collecting dmesg
      hwsim tests: Reset at the end of a test
      hwsim tests: Silence modprobe warnings
      hwsim tests: Silence chown warnings
      hwsim tests: Add scripts to run in a VM


PS.

There was a small regression in the earlier SQL change that ended up
breaking some of my test reporting: The run variable had changed from
integer to string and did not match SQL queries anymore with sqlite
typeless design. It was trivial to fix this, though, once noticing the
different reports.
Johannes Berg Oct. 31, 2013, 11:55 a.m. UTC | #2
On Thu, 2013-10-31 at 11:21 +0200, Jouni Malinen wrote:

> There was a small regression in the earlier SQL change that ended up
> breaking some of my test reporting: The run variable had changed from
> integer to string and did not match SQL queries anymore with sqlite
> typeless design. It was trivial to fix this, though, once noticing the
> different reports.

Oops, sorry.

johannes
diff mbox

Patch

diff --git a/tests/hwsim/run-all.sh b/tests/hwsim/run-all.sh
index 4822534..2a3e365 100755
--- a/tests/hwsim/run-all.sh
+++ b/tests/hwsim/run-all.sh
@@ -10,7 +10,7 @@  fi
 if [ -z "$DBFILE" ]; then
     DB=""
 else
-    DB="-S $DBFILE"
+    DB="-S $DBFILE --commit $(git rev-parse HEAD)"
     if [ -n "$BUILD" ]; then
 	DB="$DB -b $BUILD"
     fi
diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
index d9a135d..568e736 100755
--- a/tests/hwsim/run-tests.py
+++ b/tests/hwsim/run-tests.py
@@ -63,7 +63,6 @@  def main():
     test_names = list(set([t.__name__ for t in tests]))
 
     run = None
-    commit = None
     print_res = False
 
     parser = argparse.ArgumentParser(description='hwsim test runner')
@@ -82,6 +81,8 @@  def main():
                         help='results filename')
     parser.add_argument('-S', metavar='<sqlite3 db>', dest='database',
                         help='database to write results to')
+    parser.add_argument('--commit', metavar='<commit id>',
+                        help='commit ID, only for database')
     parser.add_argument('-b', metavar='<build>', dest='build', help='build ID')
     parser.add_argument('-L', action='store_true', dest='update_tests_db',
                         help='List tests (and update descriptions in DB)')
@@ -119,13 +120,6 @@  def main():
 
     if conn:
         run = str(int(time.time()))
-        try:
-            with open("commit") as f:
-                val = f.readlines()
-                if len(val) > 0:
-                    commit = val[0].rstrip()
-        except IOError:
-            pass
 
     if args.update_tests_db:
         for t in tests:
@@ -203,7 +197,7 @@  def main():
             else:
                 passed.append(t.__name__)
                 result = "PASS"
-            report(conn, args.build, commit, run, t.__name__, result, diff)
+            report(conn, args.build, args.commit, run, t.__name__, result, diff)
             result = result + " " + t.__name__ + " "
             result = result + str(diff.total_seconds()) + " " + str(end)
             logger.info(result)
@@ -219,7 +213,7 @@  def main():
             diff = end - start
             logger.info(e)
             failed.append(t.__name__)
-            report(conn, args.build, commit, run, t.__name__, "FAIL", diff)
+            report(conn, args.build, args.commit, run, t.__name__, "FAIL", diff)
             result = "FAIL " + t.__name__ + " " + str(diff.total_seconds()) + " " + str(end)
             logger.info(result)
             if log_to_file:
diff --git a/tests/hwsim/start.sh b/tests/hwsim/start.sh
index 034db2b..8185968 100755
--- a/tests/hwsim/start.sh
+++ b/tests/hwsim/start.sh
@@ -51,7 +51,6 @@  else
 fi
 
 $DIR/stop-wifi.sh
-git show -s --format=%H > commit
 sudo modprobe mac80211_hwsim radios=5
 if [ "$CONCURRENT" = "y" ]; then
     sudo iw wlan0 interface add sta0 type station