From: "Andrea Arteaga" <andyspiros@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/auto-numerical-bench:master commit in: /
Date: Mon, 6 Jun 2011 20:05:18 +0000 (UTC) [thread overview]
Message-ID: <e929ad6df4c9e9ce5656b5aa79b27e78ad13633d.spiros@gentoo> (raw)
commit: e929ad6df4c9e9ce5656b5aa79b27e78ad13633d
Author: spiros <andyspiros <AT> gmail <DOT> com>
AuthorDate: Mon Jun 6 20:04:03 2011 +0000
Commit: Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
CommitDate: Mon Jun 6 20:04:03 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=e929ad6d
User input interface begin
---
PortageUtils.py | 2 +-
blas.py | 4 +-
main.py | 87 +++++++++++++++++++++++++++++++++++++++----------------
3 files changed, 65 insertions(+), 28 deletions(-)
diff --git a/PortageUtils.py b/PortageUtils.py
index 1cb1521..c27dc79 100644
--- a/PortageUtils.py
+++ b/PortageUtils.py
@@ -14,7 +14,7 @@ def available_packages(pattern):
every matching pattern in the portage tree and installed overlays.
"""
return [portage.catpkgsplit(l) \
- for l in cmd.getoutput('equery -q list -p -e ' + pattern).split()]
+ for l in cmd.getoutput('equery -q list -po ' + pattern).split()]
def install_package(package, env={}, root='/', pkgdir='usr/portage/packages'):
diff --git a/blas.py b/blas.py
index 88ebe90..2cf1ec8 100644
--- a/blas.py
+++ b/blas.py
@@ -23,8 +23,8 @@ class Module:
'syr2', 'ger', 'rot', 'matrix_matrix', 'aat',
'trisolve_vector', 'trisolve_matrix', 'trmm')]
- # Create dir. If alls results already exist use them, otherwise
- # remove old results
+ # Create dir. If all results already exist use them, otherwise
+ # remove old results
runtests = False
if os.path.exists(testdir):
runtests = all([os.path.exists(i) for i in files])
diff --git a/main.py b/main.py
index dcd0488..5f2f0d3 100644
--- a/main.py
+++ b/main.py
@@ -1,4 +1,4 @@
-import os, sys
+import os, sys, shlex
import commands as cmd
from PortageUtils import *
@@ -37,6 +37,22 @@ def print_usage():
print "Usage: benchmarks [blas|cblas|lapack]"
+def tests_from_input(input):
+ tests = {}
+ for line in input.split('\n'):
+ line = line.strip()
+ spl = shlex.split(line)
+ if len(spl) < 2:
+ continue
+ package = available_packages(spl[1])
+ env = {}
+ for var in spl[2:]:
+ s = var.split('=')
+ env[s[0]] = s[1]
+ tests[spl[0]] = {'package' : package , 'env' : env}
+ return tests
+
+
# Import the desired module or print help and exit
try:
tmp = __import__(sys.argv[1], fromlist = ['Module'])
@@ -61,27 +77,45 @@ used at compile-time as dictionary (it can just be a void one).
After the tests every successful tested item will contain the item "result",
which can contain any type of data and will be used for the final report.
"""
-tests = {
- "abcde" : {
- "package" : ('sci-libs', 'blas-reference', '3.3.1', 'r1'),
- "env" : {'FC' : 'gfortran'}
- },
-
- "fghij" : {
- "package" : ('dev-cpp', 'eigen', '3.0.0', 'r1'),
- "env" : {'CXX' : 'gcc', 'CXXFLAGS' : '-O2'}
- },
-
+#tests = {
+# "abcde" : {
+# "package" : ('sci-libs', 'blas-reference', '3.3.1', 'r1'),
+# "env" : {'FC' : 'gfortran'}
+# },
+#
+# "fghij" : {
+# "package" : ('dev-cpp', 'eigen', '3.0.0', 'r1'),
+# "env" : {'CXX' : 'gcc', 'CXXFLAGS' : '-O2'}
+# },
+#
# "klmno" : {
# "package" : ('dev-cpp', 'eigen', '3.0.0', 'r1'),
# "env" : {'CXX' : 'icc', 'CXXFLAGS' : '-O3'}
# },
+#
+# "pqrst" : {
+# "package" : ('sci-libs', 'blas-reference', '3.3.1', 'r1'),
+# "env" : {'FC' : 'ifort'}
+# }
+#}
- "pqrst" : {
- "package" : ('sci-libs', 'blas-reference', '3.3.1', 'r1'),
- "env" : {'FC' : 'ifort'}
- }
-}
+
+"""
+The test variable is generated from a string which can be read from input.
+Here is an example of the parsed input.
+Every line contains a configuration and will be an entry in the tests
+dictionary; the line has to contain:
+- an identification string
+- a package description, which can, but does not must to, contain a version
+- a list of environment variables separated by means of spaces
+"""
+input = '''
+abcde blas-reference-3.3.1-r1 FC=gfortran
+fghij dev-cpp/eigen-3.0.0-r1 CXX=gcc CXXFLAGS='-O2'
+klmno dev-cpp/eigen-3.0.0-r1 CXX=icc CXXFLAGS='-O3'
+pqrst sci-libs/blas-reference-3.3.1-r1 FC=ifort
+'''
+tests = tests_from_input(input)
for tn,(name,test) in enumerate(tests.items(),1):
Print("BEGIN TEST %i" % tn)
@@ -93,14 +127,17 @@ for tn,(name,test) in enumerate(tests.items(),1):
Print.down()
package = "%s/%s-%s-%s" % test['package']
Print("Emerging package %s" % package)
- try:
- install_package( \
- test['package'], env=test['env'], root=root, pkgdir=pkgdir)
- except InstallException as e:
- Print("Package %s failed to emerge: %s" % (package, e.command))
- Print.up()
- print
- continue
+ if os.exists(pkgdir+package+".tbz2"):
+ Print("Package already emerged - skipping")
+ else:
+ try:
+ install_package( \
+ test['package'], env=test['env'], root=root, pkgdir=pkgdir)
+ except InstallException as e:
+ Print("Package %s failed to emerge: %s" % (package, e.command))
+ Print.up()
+ print
+ continue
Print("Package emerged")
# Find implementations
next reply other threads:[~2011-06-06 20:05 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-06 20:05 Andrea Arteaga [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-06-10 0:52 [gentoo-commits] proj/auto-numerical-bench:master commit in: / Andrea Arteaga
2011-06-10 1:02 Andrea Arteaga
2011-06-13 14:12 Andrea Arteaga
2011-06-13 23:53 Andrea Arteaga
2011-06-15 12:56 Andrea Arteaga
2011-06-15 23:25 Andrea Arteaga
2011-07-13 21:48 Andrea Arteaga
2011-07-17 0:21 Andrea Arteaga
2011-08-09 0:00 Andrea Arteaga
2011-08-09 0:00 Andrea Arteaga
2011-08-12 22:56 Andrea Arteaga
2011-08-14 12:35 Andrea Arteaga
2011-08-14 12:59 Andrea Arteaga
2011-08-15 21:57 Andrea Arteaga
2011-08-16 23:38 Andrea Arteaga
2011-08-22 18:15 Andrea Arteaga
2012-02-24 17:22 Andrea Arteaga
2012-02-28 19:20 Andrea Arteaga
2012-03-05 15:48 Andrea Arteaga
2012-04-09 22:58 Andrea Arteaga
2012-08-04 1:11 Andrea Arteaga
2012-08-11 18:00 Andrea Arteaga
2012-09-02 11:41 Andrea Arteaga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e929ad6df4c9e9ce5656b5aa79b27e78ad13633d.spiros@gentoo \
--to=andyspiros@gmail.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox