test.py 1.34 KB
Newer Older
yoogx's avatar
yoogx committed
1
2
#! /usr/bin/python

Jerome Hugues's avatar
Jerome Hugues committed
3
4
import ocarina
import lmp
yoogx's avatar
yoogx committed
5
6
7
8
9
10

def main ():
    '''Test function'''

    err=ocarina.load("rma.aadl");                   # load a file
    print 'load("rma.aadl")'
Jerome Hugues's avatar
Jerome Hugues committed
11
12
13
    print err
    if err[1] != None:
      print 'info message: ', err[1]
yoogx's avatar
yoogx committed
14
    if err[2]!=[]:
Jerome Hugues's avatar
Jerome Hugues committed
15
      print 'warning message: ', err[2]
yoogx's avatar
yoogx committed
16
    if err[3]!=[]:
Jerome Hugues's avatar
Jerome Hugues committed
17
      print 'error message: ', err[3]
yoogx's avatar
yoogx committed
18
      sys.exit(2)
Jerome Hugues's avatar
Jerome Hugues committed
19

yoogx's avatar
yoogx committed
20
21
    err=ocarina.load("deployment.aadl");            # load a file
    print 'load("deployment.aadl")'
Jerome Hugues's avatar
Jerome Hugues committed
22
23
    if err[1] != None:
      print 'info message: ', err[1]
yoogx's avatar
yoogx committed
24
    if err[2]!=[]:
Jerome Hugues's avatar
Jerome Hugues committed
25
      print 'warning message: ', err[2]
yoogx's avatar
yoogx committed
26
    if err[3]!=[]:
Jerome Hugues's avatar
Jerome Hugues committed
27
      print 'error message: ', err[3]
yoogx's avatar
yoogx committed
28
      sys.exit(2)
Jerome Hugues's avatar
Jerome Hugues committed
29

yoogx's avatar
yoogx committed
30
31
    err=ocarina.analyze();                          # analyze models
    print 'ocarina.analyze()'
Jerome Hugues's avatar
Jerome Hugues committed
32
33
    if err[1] != None:
      print 'info message: ', err[1]
yoogx's avatar
yoogx committed
34
    if err[2]!=[]:
Jerome Hugues's avatar
Jerome Hugues committed
35
      print 'warning message: ', err[2]
yoogx's avatar
yoogx committed
36
    if err[3]!=[]:
Jerome Hugues's avatar
Jerome Hugues committed
37
      print 'error message: ', err[3]
yoogx's avatar
yoogx committed
38
      sys.exit(2)
Jerome Hugues's avatar
Jerome Hugues committed
39
40
41
42
43

    err=ocarina.instantiate("rma.impl");           # instantiate system
    print 'ocarina.instantiate("rma.impl")'
    if err[1] != None:
      print 'info message: ', err[1]
yoogx's avatar
yoogx committed
44
    if err[2]!=[]:
Jerome Hugues's avatar
Jerome Hugues committed
45
      print 'warning message: ', err[2]
yoogx's avatar
yoogx committed
46
    if err[3]!=[]:
Jerome Hugues's avatar
Jerome Hugues committed
47
      print 'error message: ', err[3]
yoogx's avatar
yoogx committed
48
49
50
51
52
      sys.exit(2)

if __name__ == "__main__":
    main ()
    sys.exit (0);                       # exit