# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+import re
+
import src
# Define all possible option for prepare command : sat prepare <options>
ldev_products,
logger)
logger.write("\n", 1)
-
+
# Construct the final commands arguments
args_clean = args_appli + args_product_opt_clean + " --source"
args_source = args_appli + args_product_opt
args_patch = args_appli + args_product_opt_patch
+
+ # If there is no more any product in the command arguments,
+ # do not call the concerned command
+ oExpr = re.compile("^--product *$")
+ do_clean = not(oExpr.search(args_product_opt_clean))
+ do_source = not(oExpr.search(args_product_opt))
+ do_patch = not(oExpr.search(args_product_opt_patch))
+
+
+ # Initialize the results to a failing status
+ res_clean = 1
+ res_source = 1
+ res_patch = 1
# Call the commands using the API
- msg = _("Clean the source directories ...")
- logger.write(msg, 3)
- res_clean = runner.clean(args_clean, batch=True, verbose = 0)
- if res_clean == 0:
- logger.write('%s\n' % src.printcolors.printc(src.OK_STATUS), 3)
- res_source = runner.source(args_source)
- res_patch = runner.patch(args_patch)
+ if do_clean:
+ msg = _("Clean the source directories ...")
+ logger.write(msg, 3)
+ res_clean = runner.clean(args_clean, batch=True, verbose = 0)
+ if res_clean == 0:
+ logger.write('%s\n\n' % src.printcolors.printc(src.OK_STATUS), 3)
+ if do_source:
+ res_source = runner.source(args_source)
+ if do_patch:
+ res_patch = runner.patch(args_patch)
return res_clean + res_source + res_patch
\ No newline at end of file
import unittest
import os
import sys
-import shutil
# get execution path
testdir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(testdir, '..', '_testTools'))
from salomeTools import Sat
-import src
-from tools import outRedirection
from tools import check_proc_existence_and_kill
import HTMLTestRunner
import os
import sys
import platform
-import shutil
# get execution path
testdir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(testdir, '..', '_testTools'))
from salomeTools import Sat
-import src
from tools import outRedirection
import HTMLTestRunner
from salomeTools import Sat
from tools import check_proc_existence_and_kill
-from tools import outRedirection
import HTMLTestRunner
-import src.xmlManager
sleep_time = 2
appli = 'appli-test'
product_name = 'PRODUCT_ARCHIVE'
- sat = Sat()
+ sat = Sat('-v4')
sat.source(appli + ' --product ' + product_name)
import src
-from tools import outRedirection
-
from salomeTools import Sat
import HTMLTestRunner
sat.config(appli)
try:
- sat.prepare(appli + " --no_sample --force")
+ sat.prepare(appli + " --force --force_patch")
OK = 'OK'
except:
pass
import unittest
import os
import sys
-import shutil
# get execution path
testdir = os.path.dirname(os.path.realpath(__file__))
sat = Sat()
sat.source(appli + ' --product ' + product_name)
- expected_src_dir = os.path.join(sat.cfg.APPLICATION.out_dir, 'SOURCES', product_name)
+ expected_src_dir = os.path.join(sat.cfg.APPLICATION.workdir, 'SOURCES', product_name)
if not os.path.exists(expected_src_dir):
OK = 'OK'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_source_dev(self):
- '''Test the source command with a product in dev mode
- '''
- OK = 'KO'
-
- appli = 'appli-test'
- product_name = 'PRODUCT_DEV'
-
- sat = Sat()
-
- sat.config(appli)
-
- expected_src_dir = src.product.get_product_config(sat.cfg, product_name).source_dir
- expected_file_path = os.path.join(expected_src_dir, 'my_test_file.txt')
- expected_text = 'HELLO WORLD\n'
-
- if os.path.exists(expected_src_dir):
- shutil.rmtree(expected_src_dir)
-
- sat.source(appli + ' --product ' + product_name)
-
- f = open(expected_file_path, 'r')
- text = f.readlines()[0]
- OK1 = 'KO'
- if text == expected_text:
- OK1 = 'OK'
-
- # output redirection
- my_out = outRedirection()
-
- sat.source(appli + ' --product ' + product_name)
-
- # stop output redirection
- my_out.end_redirection()
-
- # get results
- res = my_out.read_results()
-
- OK2 = 'KO'
- if "source directory already exists" in res:
- OK2 = 'OK'
-
- # output redirection
- my_out = outRedirection()
-
- sat.source(appli + ' --product ' + product_name + ' --force')
-
- # stop output redirection
- my_out.end_redirection()
-
- # get results
- res = my_out.read_results()
-
- OK3 = 'KO'
- if "source directory already exists" not in res:
- OK3 = 'OK'
-
- if (OK1, OK2, OK3)==('OK', 'OK', 'OK'):
- OK = 'OK'
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, 'OK')
def test_description(self):
'''Test the sat -h source