~ubuntu-branches/ubuntu/vivid/adios/vivid-proposed

« back to all changes in this revision

Viewing changes to utils/skel/lib/skel_test_plan.py

  • Committer: Package Import Robot
  • Author(s): Alastair McKinstry
  • Date: 2014-06-16 23:06:38 UTC
  • mfrom: (15.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20140616230638-cxryhot6b8ge32l6
Tags: 1.7.0-1
* New upstream release.
* Add adios.pc pkgconfig file. adios_config now uses this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
import yaml
 
4
 
 
5
 
 
6
# A representation of a skel test plan that is stored in a yaml document
 
7
class skel_test_plan:
 
8
    def __init__ (self, filename):
 
9
        stream = file (filename, 'r')
 
10
        self.doc = yaml.load(stream)
 
11
 
 
12
 
 
13
 
 
14
    # Returns a list of test objects that implement the test plan
 
15
    def get_tests (self):
 
16
 
 
17
        tests = []
 
18
        for i in range (len (self.doc) ): # Assume each element of doc is a test
 
19
            tests.append (test (self.doc[i]['procs'], self.doc[i]['name'], self.doc[i]['method'], self.doc[i]['parameters'], self.doc[i]['decomp-procs']) )
 
20
 
 
21
        # This is the old way, convenient, but lacking in flexibility
 
22
        #tests = []
 
23
        #for i in range (len(self.doc['procs']) ):
 
24
        #    for j in range (len(self.doc['methods']) ):
 
25
        #        name = "T%s_%i" % (chr (ord('a') + j), self.doc['procs'][i])
 
26
        #        tests.append (test (self.doc['procs'][i], name, 
 
27
        #                      self.doc['methods'][j]['m'],
 
28
        #                      self.doc['methods'][j]['p']) )
 
29
 
 
30
        return tests        
 
31
 
 
32
 
 
33
class test:
 
34
    def __init__ (self, num_procs, subdir, method, parameters, decomp_procs):
 
35
        self.num_procs = num_procs
 
36
        self.subdir = subdir
 
37
        self.method = method
 
38
        self.parameters = parameters
 
39
        self.decomp_procs = decomp_procs
 
40
 
 
41
    def get_subdir (self):
 
42
        return self.subdir
 
43
 
 
44
    def get_method (self):
 
45
        return self.method
 
46
 
 
47
    def get_parameters (self):
 
48
        return self.parameters
 
49
 
 
50
    def get_decomp_procs (self):
 
51
        return self.decomp_procs
 
52
 
 
53
    def to_yaml (self):
 
54
        return "procs: %s\nmethod: %s\nparameters: %s\ndecomp_procs: %s" % (self.num_procs, self.method, self.parameters, self.decomp_procs)
 
55
 
 
56
 
 
57
 
 
58
 
 
59
def main(argv=None):
 
60
    b = skel_test_plan ("test_plan.yaml")
 
61
 
 
62
    print b.get_tests()
 
63
 
 
64
 
 
65
if __name__ == "__main__":
 
66
    main()