]> SALOME platform Git repositories - tools/sat.git/blob - test/test_sat5_0/compilation/test_make.py
Salome HOME
add AllTestLauncher and src/loggingSimple.py etc...
[tools/sat.git] / test / test_sat5_0 / compilation / test_make.py
1 #!/usr/bin/env python
2 #-*- coding:utf-8 -*-
3
4 #  Copyright (C) 2010-2018  CEA/DEN
5 #
6 #  This library is free software; you can redistribute it and/or
7 #  modify it under the terms of the GNU Lesser General Public
8 #  License as published by the Free Software Foundation; either
9 #  version 2.1 of the License.
10 #
11 #  This library is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 #  Lesser General Public License for more details.
15 #
16 #  You should have received a copy of the GNU Lesser General Public
17 #  License along with this library; if not, write to the Free Software
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19
20 import os
21 import sys
22 import unittest
23
24 import src.product
25 from src.salomeTools import Sat
26
27 class TestCase(unittest.TestCase):
28     """Test of the make command"""
29
30     def test_010(self):
31         # Test the configure command without any option
32         OK = 'KO'
33
34         appli = 'appli-test'
35         product_name = 'PRODUCT_GIT'
36
37         sat = Sat()
38                             
39         sat.prepare(appli + ' --product ' + product_name)
40         expected_build_dir = src.product.get_product_config(sat.cfg, product_name).build_dir
41         expected_file_path = os.path.join(expected_build_dir, 'hello')
42        
43         sat.configure(appli + ' --product ' + product_name)        
44         sat.make(appli + ' --product ' + product_name)
45         
46         if os.path.exists(os.path.join(expected_build_dir, expected_file_path)):
47             OK = 'OK'         
48         # pyunit method to compare 2 str
49         self.assertEqual(OK, 'OK')
50
51     def test_020(self):
52         # Test the make command with an option
53         OK = 'KO'
54         appli = 'appli-test'
55         product_name = 'PRODUCT_GIT'
56
57         sat = Sat()
58                             
59         sat.prepare(appli + ' --product ' + product_name)
60         expected_build_dir = src.product.get_product_config(sat.cfg, product_name).build_dir
61         expected_file_path = os.path.join(expected_build_dir, 'hello')
62        
63         sat.configure(appli + ' --product ' + product_name)   
64         sat.make(appli + ' --product ' + product_name + ' --option -j3')
65         
66         if os.path.exists(os.path.join(expected_build_dir, expected_file_path)):
67             OK = 'OK'         
68         # pyunit method to compare 2 str
69         self.assertEqual(OK, 'OK')
70
71     def test_030(self):
72         # Test the make command with a product in script mode
73         OK = 'KO'
74
75         appli = 'appli-test'
76         product_name = 'Python'
77
78         sat = Sat()
79                             
80         sat.prepare(appli + ' --product ' + product_name)
81         expected_install_dir = src.product.get_product_config(sat.cfg, product_name).install_dir
82         expected_file = "bin/python2.7"
83         
84         sat.make(appli + ' --product ' + product_name)
85         
86         if os.path.exists(os.path.join(expected_install_dir, expected_file)):
87             OK = 'OK'         
88         # pyunit method to compare 2 str
89         self.assertEqual(OK, 'OK')
90
91     def test_040(self):
92         # Test the sat -h make 
93         OK = "KO"
94
95         import make
96         
97         if "The make command executes the \"make\" command" in make.description():
98             OK = "OK"
99
100         # pyunit method to compare 2 str
101         self.assertEqual(OK, "OK")
102
103 # test launch
104 if __name__ == '__main__':
105     unittest.main()
106     pass