# =====================================================================
# Load the PROJECTS
- if "PROJECTS" in cfg:
- cfg.PROJECTS.addMapping("projects",
- src.pyconf.Mapping(cfg.PROJECTS),
- "The projects definition\n")
- for project_pyconf_path in cfg.PROJECTS.project_file_paths:
- if not os.path.exists(project_pyconf_path):
- #msg = _("WARNING: The project file %s cannot be found. "
- # "It will be ignored\n" % project_pyconf_path)
- #sys.stdout.write(src.printcolors.printcWarning(msg))
- continue
- project_name = os.path.basename(
- project_pyconf_path)[:-len(".pyconf")]
- try:
- project_cfg = src.pyconf.Config(open(project_pyconf_path))
- except Exception as e:
- raise src.SatException(_("Error in configuration file: "
- "%(file_path)s\n %(error)s") % \
- {'file_path' : project_cfg, 'error': str(e) })
- cfg.PROJECTS.projects.addMapping(project_name,
- src.pyconf.Mapping(cfg.PROJECTS.projects),
- "The %s project\n" % project_name)
- cfg.PROJECTS.projects[project_name]=project_cfg
- cfg.PROJECTS.projects[project_name]["file_path"] = \
- project_pyconf_path
-
+ projects_cfg = src.pyconf.Config()
+ projects_cfg.addMapping("PROJECTS",
+ src.pyconf.Mapping(projects_cfg),
+ "The projects\n")
+ projects_cfg.PROJECTS.addMapping("projects",
+ src.pyconf.Mapping(cfg.PROJECTS),
+ "The projects definition\n")
+
+ for project_pyconf_path in cfg.PROJECTS.project_file_paths:
+ if not os.path.exists(project_pyconf_path):
+ msg = _("WARNING: The project file %s cannot be found. "
+ "It will be ignored\n" % project_pyconf_path)
+ sys.stdout.write(src.printcolors.printcWarning(msg))
+ continue
+ project_name = os.path.basename(
+ project_pyconf_path)[:-len(".pyconf")]
+ try:
+ project_cfg = src.pyconf.Config(open(project_pyconf_path))
+ except Exception as e:
+ raise src.SatException(_("Error in configuration file: "
+ "%(file_path)s\n %(error)s") % \
+ {'file_path' : project_pyconf_path, 'error': str(e) })
+ projects_cfg.PROJECTS.projects.addMapping(project_name,
+ src.pyconf.Mapping(projects_cfg.PROJECTS.projects),
+ "The %s project\n" % project_name)
+ projects_cfg.PROJECTS.projects[project_name]=project_cfg
+ projects_cfg.PROJECTS.projects[project_name]["file_path"] = \
+ project_pyconf_path
+
+ merger.merge(cfg, projects_cfg)
# apply overwrite from command line if needed
for rule in self.get_command_line_overrides(options, ["PROJECTS"]):
"ignored if this key exists in the site.pyconf"
" file of salomTools).\n")
+ user_cfg.USER.addMapping("log_dir",
+ src.pyconf.Reference(
+ user_cfg,
+ src.pyconf.DOLLAR,
+ 'workdir + $VARS.sep + "LOGS"'),
+ "The log reposotory\n")
+
#
src.ensure_path_exists(config.VARS.personalDir)
src.ensure_path_exists(os.path.join(config.VARS.personalDir,
gui = None
if options.publish:
# Copy the stylesheets in the log directory
- log_dir = runner.cfg.SITE.log.log_dir
+ log_dir = runner.cfg.USER.log_dir
xsl_dir = os.path.join(runner.cfg.VARS.srcDir, 'xsl')
files_to_copy = []
files_to_copy.append(os.path.join(xsl_dir, STYLESHEET_GLOBAL))
# Instanciate the Gui in order to produce the xml files that contain all
# the boards
- gui = Gui(runner.cfg.SITE.log.log_dir,
+ gui = Gui(runner.cfg.USER.log_dir,
today_jobs.ljobs,
today_jobs.ljobs_not_today,
file_boards = options.input_boards)
(options, args) = parser.parse_args(args)
# get the log directory.
- logDir = runner.cfg.SITE.log.log_dir
+ logDir = runner.cfg.USER.log_dir
# Print a header
nb_files_log_dir = len(glob.glob(os.path.join(logDir, "*")))
# Create or update the hat xml that gives access to all the commands log files
xmlHatFilePath = os.path.join(logDir, 'hat.xml')
- src.logger.update_hat_xml(runner.cfg.SITE.log.log_dir,
+ src.logger.update_hat_xml(runner.cfg.USER.log_dir,
application = runner.cfg.VARS.application,
notShownCommands = notShownCommands)
logger.write("\n", 2, False)
logger.write(_("\nGenerate the specific test log\n"), 5)
- out_dir = os.path.join(runner.cfg.SITE.log.log_dir, "TEST")
+ out_dir = os.path.join(runner.cfg.USER.log_dir, "TEST")
src.ensure_path_exists(out_dir)
name_xml_board = logger.logFileName.split(".")[0] + "board" + ".xml"
create_test_report(runner.cfg,
SITE :
{
- log :
- {
- log_dir : $USER.workdir + "/LOGS"
- }
#base : $USER.workdir + $VARS.sep + "BASE-FROM-SITE"
test :{
tmp_dir_with_application : '/tmp' + $VARS.sep + $VARS.user + $VARS.sep + $APPLICATION.name + $VARS.sep + 'test'
# Construct xml log file location for sat prints.
logFileName = config.VARS.datehour + "_" + config.VARS.command + ".xml"
- logFilePath = os.path.join(config.SITE.log.log_dir, logFileName)
+ logFilePath = os.path.join(config.USER.log_dir, logFileName)
# Construct txt file location in order to log
# the external commands calls (cmake, make, git clone, etc...)
txtFileName = config.VARS.datehour + "_" + config.VARS.command + ".txt"
- txtFilePath = os.path.join(config.SITE.log.log_dir, "OUT", txtFileName)
+ txtFilePath = os.path.join(config.USER.log_dir, "OUT", txtFileName)
src.ensure_path_exists(os.path.dirname(logFilePath))
src.ensure_path_exists(os.path.dirname(txtFilePath))
self.xmlFile.write_tree(stylesheet = "command.xsl")
# Dump the config in a pyconf file in the log directory
- logDir = self.config.SITE.log.log_dir
+ logDir = self.config.USER.log_dir
dumpedPyconfFileName = (self.config.VARS.datehour
+ "_"
+ self.config.VARS.command
skey = repr(key)
if comment:
stream.write('%s#%s' % (indstr, comment))
+ if skey.startswith("u'"):
+ skey = skey[1:]
stream.write('%s%-*s :' % (indstr, maxlen, skey))
value = data[key]
if isinstance(value, Container):
sat.config('appli-test -v USER.browser')
# get log file path
- logDir = sat.cfg.SITE.log.log_dir
+ logDir = sat.cfg.USER.log_dir
logPath = os.path.join(logDir, sat.cfg.VARS.datehour + "_" + sat.cfg.VARS.command + ".xml")
if os.path.exists(logPath):
sat.config('appli-test -v VARS.python')
- nb_logs = len(os.listdir(sat.cfg.SITE.log.log_dir))
+ nb_logs = len(os.listdir(sat.cfg.USER.log_dir))
nb_logs_u = unicode(str(nb_logs) + "\n1")
sys.stdin = io.StringIO(nb_logs_u)
sat.config('-v VARS.user')
- nb_logs_t0 = len(os.listdir(sat.cfg.SITE.log.log_dir))
+ nb_logs_t0 = len(os.listdir(sat.cfg.USER.log_dir))
sat.log('--clean 1')
- nb_logs_t1 = len(os.listdir(sat.cfg.SITE.log.log_dir))
+ nb_logs_t1 = len(os.listdir(sat.cfg.USER.log_dir))
if nb_logs_t1-nb_logs_t0 == 0:
OK = "OK"
sat.config('-v VARS.user')
- nb_logs_t0 = len(os.listdir(sat.cfg.SITE.log.log_dir))
+ nb_logs_t0 = len(os.listdir(sat.cfg.USER.log_dir))
- if os.path.exists(sat.cfg.SITE.log.log_dir + "_save"):
- shutil.rmtree(sat.cfg.SITE.log.log_dir + "_save")
- shutil.copytree(sat.cfg.SITE.log.log_dir,sat.cfg.SITE.log.log_dir + "_save")
+ if os.path.exists(sat.cfg.USER.log_dir + "_save"):
+ shutil.rmtree(sat.cfg.USER.log_dir + "_save")
+ shutil.copytree(sat.cfg.USER.log_dir,sat.cfg.USER.log_dir + "_save")
sat.log('--clean ' + str(nb_logs_t0))
- nb_logs_t1 = len(os.listdir(sat.cfg.SITE.log.log_dir))
+ nb_logs_t1 = len(os.listdir(sat.cfg.USER.log_dir))
- shutil.rmtree(sat.cfg.SITE.log.log_dir)
- shutil.move(sat.cfg.SITE.log.log_dir + "_save", sat.cfg.SITE.log.log_dir)
+ shutil.rmtree(sat.cfg.USER.log_dir)
+ shutil.move(sat.cfg.USER.log_dir + "_save", sat.cfg.USER.log_dir)
if nb_logs_t0-nb_logs_t1 > 10:
OK = "OK"
check_proc_existence_and_kill_multi(browser + ".*" + "hat\.xml", 10)
# Read and check the hat.xml file contains at least one log file corresponding to log
- hatFilePath = os.path.join(sat.cfg.SITE.log.log_dir, "hat.xml")
+ hatFilePath = os.path.join(sat.cfg.USER.log_dir, "hat.xml")
xmlHatFile = src.xmlManager.ReadXmlFile(hatFilePath)
for field in xmlHatFile.xmlroot:
if field.attrib[b'cmd'] == b'log':