[llvm-commits] [zorg] r105974 - in /zorg/trunk/lnt/lnt/tests: misc/ misc/GetSourceVersion nt.py

Daniel Dunbar daniel at zuster.org
Mon Jun 14 16:07:55 PDT 2010


Author: ddunbar
Date: Mon Jun 14 18:07:55 2010
New Revision: 105974

URL: http://llvm.org/viewvc/llvm-project?rev=105974&view=rev
Log:
LNT/nt: Add local copy of GetSourceVersion, so we don't depend on any particular
LLVM revision.

Added:
    zorg/trunk/lnt/lnt/tests/misc/
    zorg/trunk/lnt/lnt/tests/misc/GetSourceVersion   (with props)
Modified:
    zorg/trunk/lnt/lnt/tests/nt.py

Added: zorg/trunk/lnt/lnt/tests/misc/GetSourceVersion
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/tests/misc/GetSourceVersion?rev=105974&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/tests/misc/GetSourceVersion (added)
+++ zorg/trunk/lnt/lnt/tests/misc/GetSourceVersion Mon Jun 14 18:07:55 2010
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+usage() {
+   echo "usage: $0 <source root>"
+   echo "  Prints the source control revision of the given source directory,"
+   echo "  the exact format of the revision string depends on the source "
+   echo "  control system. If the source control system isn't known, the output"
+   echo "  is empty and the exit code is 1."
+   exit 1
+}
+
+if [ $# != 1 ] || [ ! -d $1 ]; then
+  usage;
+fi
+
+cd $1
+if [ -d .svn ]; then
+   svnversion
+elif [ -d .git/svn ]; then
+   git svn info | grep 'Revision:' | cut -d: -f2-
+elif [ -d .git ]; then
+   git log -1 --pretty=format:%H
+else
+   exit 1;
+fi
+
+exit 0

Propchange: zorg/trunk/lnt/lnt/tests/misc/GetSourceVersion
------------------------------------------------------------------------------
    svn:executable = *

Modified: zorg/trunk/lnt/lnt/tests/nt.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/tests/nt.py?rev=105974&r1=105973&r2=105974&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/tests/nt.py (original)
+++ zorg/trunk/lnt/lnt/tests/nt.py Mon Jun 14 18:07:55 2010
@@ -13,6 +13,10 @@
 from lnt.testing.util.commands import note, warning, error, fatal
 from lnt.testing.util.commands import capture, which
 
+# FIXME: Add util command for this.
+kGetSourceVersionPath = os.path.join(os.path.dirname(__file__),
+                                     'misc', 'GetSourceVersion')
+
 def timestamp():
     return datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')
 
@@ -370,14 +374,10 @@
 
     # FIXME: Hack, use better method of getting versions. Ideally, from binaries
     # so we are more likely to be accurate.
-    run_info['llvm_revision'] = capture([os.path.join(opts.llvm_src_root,
-                                                      'utils',
-                                                      'GetSourceVersion'),
+    run_info['llvm_revision'] = capture([kGetSourceVersionPath,
                                          opts.llvm_src_root],
                                         include_stderr=True).strip()
-    run_info['test_suite_revision'] = capture([os.path.join(opts.llvm_src_root,
-                                                            'utils',
-                                                            'GetSourceVersion'),
+    run_info['test_suite_revision'] = capture([kGetSourceVersionPath,
                                                opts.test_suite_root],
                                              include_stderr=True).strip()
     run_info.update(public_make_variables)





More information about the llvm-commits mailing list