Skip to content
Snippets Groups Projects
Verified Commit 1a36cf96 authored by Nicolas KAROLAK's avatar Nicolas KAROLAK
Browse files

temp fix: git reset repo

parent c9a4b0e0
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script to start tests and to manage their results
"""
from io import StringIO
import datetime
import os
......@@ -12,8 +13,8 @@ import sys
import uuid
import glob
import utils
from utils import log
# temp fix: broken git state
# import utils
OUT_OF_SUPPORT_TEXT = """\033[93mWarning:
The system is out of support, UbiCast will not be notified if errors are detected.
......@@ -86,6 +87,10 @@ class Tester:
NO_MAIL_FAILURES_COUNT = 5
def __init__(self, *args):
# temp fix: broken git state
import utils
from utils import log
log("\033[96m-------------------------------\033[0m")
log("\033[96m- UbiCast applications tester -\033[0m")
log("\033[96m-------------------------------\033[0m")
......@@ -188,6 +193,10 @@ class Tester:
return criticality, description
def discover_tests(self, basic_only=False, msuser=None):
# temp fix: broken git state
import utils
from utils import log
ignored_tests = utils.get_conf("TESTER_IGNORED_TESTS", "").split(",")
ignored_tests.append("__init__.py")
# Get standard tests
......@@ -305,6 +314,10 @@ class Tester:
return tests
def run_tests(self, tests, email=False, email_if_fail=False):
# temp fix: broken git state
import utils
from utils import log
# Run all tests
successes = 0
failures = 0
......@@ -551,18 +564,6 @@ Content-transfer-encoding: utf-8
if __name__ == "__main__":
# temp fix: broken git state
branch = 'stable'
os.chdir(os.path.dirname(os.path.abspath(os.path.expanduser(__file__))))
sys.stdout.write('Updating envsetup: ')
sys.stdout.flush()
subprocess.call('find . -name *.pyc -type f -delete', shell=True)
subprocess.call('find . -name __pycache__ -type d -delete', shell=True)
if branch:
subprocess.check_call(['git', 'checkout', branch])
subprocess.check_call(['git', 'fetch', '--recurse-submodules', '--all'])
subprocess.check_call(['git', 'reset', '--hard', 'origin/{}'.format(branch)])
subprocess.check_call(['git', 'pull', '--recurse-submodules'])
subprocess.check_call(['git', 'submodule', 'update', '--init', '--recursive'])
subprocess.call('find . -type d -empty -delete', shell=True)
subprocess.call(["python3", "/root/envsetup/update_envsetup.py"])
Tester(*sys.argv[1:])
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import OrderedDict
from pathlib import Path
import os
import subprocess
import sys
import utils
def load_conf() -> dict:
conf = {}
base_dir = str(Path(__file__).expanduser().resolve().parent)
files = (
(str(Path(base_dir, "global-conf.sh")), True),
(str(Path(base_dir, "auto-generated-conf.sh")), False),
(str(Path(base_dir, "conf.sh")), False),
)
only_default = True
override = OrderedDict()
for path, is_default in files:
if not Path(path).exists():
if is_default:
return dict()
continue
# Load conf
with open(path, "r") as fo:
content = fo.read()
# Parse conf
for line in content.split("\n"):
line = line.strip()
if line and not line.startswith("#") and "=" in line:
name, *val = line.split("=")
name = name.strip(" \t'\"")
val = ("=".join(val)).strip(" \t'\"")
conf[name] = val
if is_default:
override[name] = False
else:
only_default = False
override[name] = True
conf["_override"] = override
return conf
def get_conf(name: str, default: str = None) -> str:
conf = load_conf()
return conf.get(name, default)
if __name__ == '__main__':
branch = utils.get_conf('ENVSETUP_BRANCH') or 'stable'
branch = get_conf('ENVSETUP_BRANCH') or 'stable'
os.chdir(os.path.dirname(os.path.abspath(os.path.expanduser(__file__))))
sys.stdout.write('Updating envsetup: ')
sys.stdout.flush()
subprocess.call('find . -name *.pyc -type f -delete', shell=True)
subprocess.call('find . -name __pycache__ -type d -delete', shell=True)
subprocess.check_call(['git', 'fetch', '--recurse-submodules', '--all'])
subprocess.check_call(['git', 'reset', '--hard', 'origin/{}'.format(branch)])
if branch:
subprocess.check_call(['git', 'checkout', branch])
subprocess.check_call(['git', 'pull', '--recurse-submodules'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment