]> rtime.felk.cvut.cz Git - linux-conf-perf.git/blobdiff - conf.py
Allow importing lcp_django from other python scripts
[linux-conf-perf.git] / conf.py
diff --git a/conf.py b/conf.py
index e870a57def171a7492ed7e1ed4b2d89d297ccc7b..13d5cd76564d118e8708ee7e70816c9e1a98b8bb 100644 (file)
--- a/conf.py
+++ b/conf.py
 import os
-from exceptions import MissingFile
-
-def pf(rfile):
-       "Relative patch of file is decoded to absolute acording to working tree."
-       return os.path.dirname(os.path.realpath(__file__)) + '/' + rfile
-
-def checkXf(f, message):
-       "Check if file is executable. If not, raise MissingFile exception."
-       if os.path.isfile(f) and os.access(f, os.X_OK):
-               return f
-       else:
-               raise MissingFile(f, message)
-
-# Global configs
-SRCARCH = 'x86' # Kernel architecture
-ARCH = SRCARCH
-linux_make_args = ['-j8']
-
-# Path settings
-linux_sources = pf('linux')
-linux_kconfig_head = 'Kconfig'
-linux_dot_config = linux_sources + '/.config'
-
-build_folder = pf('build/')
-phase_file = build_folder + '/phase'
-symbol_map_file = build_folder + '/symbol_map' # Also defined in kconfig_parser
-rules_file = build_folder + '/rules' # Also defined in kconfig_parser
-solved_file = build_folder + '/solved'
-required_file = build_folder + '/required'
-dot_config_fragment_file = build_folder + '/dot_config_fragment'
-dot_config_back_file = build_folder + '/dot_config_back'
-solution_file = build_folder + '/solution'
-iteration_file = build_folder + '/iteration'
-
-# Programs paths
-parse_kconfig = checkXf(pf('scripts/parse_kconfig/parse'), 'You must build programs first.')
-write_config = checkXf(pf('scripts/write_config/write'), 'You must build programs first.')
-
-# Programs output show/hide
+import sys
+import re
+import importlib.machinery
+import multiprocessing
+
+## Global configs
+# kernel_arch
+# This defines environment variable ARCH for linux kernel.
+# Change this to change target architecture
+kernel_arch = 'x86'
+
+# kernle_env
+# Enviroment variables for Linux
+kernel_env = {'SRCARCH': kernel_arch, 'ARCH': kernel_arch, 'KERNELVERSION': kernel_arch}
+# build_command
+# Command executed for kernel build in linux folder.
+build_command = ['make', '-j', str(multiprocessing.cpu_count())]
+
+# boot_command
+# Command executed for booting. Output of this command is saved to output folder.
+boot_command = ['echo', 'bootit']
+# boot_timeout
+# Set timeout of boot process if no output is generated for selected seconds
+boot_timeout = 120
+
+# parse_command
+# Command to parse double value from boot output
+parse_command = ['echo', '0']
+
+# measurement_identifier
+# Identifier of measurement can consist of measure tool name and version
+measure_identifier = 'cyclictest-v0.92'
+
+# picosat_args
+# Additional arguments passed to PicoSAT.
+picosat_args = []
+
+# db_database
+# Database in PostgreSQL to be used for this tools
+db_database = 'linux-conf-perf'
+
+# multithread
+# Define if measurement and kernel build should be executed in parallel.
+multithread = False
+# multithread_buffer
+# Defines maximal number of buffered configurations before generating is suspended.
+multithread_buffer = 32
+
+## Programs output show/hide
+# These options hides output of launched programs from terminal.
+# If variable is True, output is printed. Otherwise is hidden.
+# What ever are these settings, output is always written to files in folder log.
 parse_kconfig_output = False
-minisat_output = False
+picosat_output = False
 kernel_config_output = True
 kernel_make_output = True
+boot_output = True
+parse_output = False
+
+## Configs for debugging
+single_loop = False # Executes only one loop and exits.
+only_config = False # Executes only to configuration phase. Building and booting phases are skipped.
+ignore_misconfig = False # Ignore if configuration wasn't applied correctly.
+#######################################
+# Most probably you don't want touch rest of these.
+## Path settings
+dot_confmk = '.conf.mk'
+dot_config = 'dot_config'
+
+linux_sources = 'linux/'
+linux_build_folder = 'linux/'
+linux_image = linux_build_folder + 'arch/' + kernel_arch + '/boot/bzImage'
+
+build_folder = 'jobfiles/'
+jobfolder_linux_image = build_folder + 'linuxImage'
+symbol_map_file = build_folder + 'symbol_map' # Also defined in parse_kconfig
+rules_file = build_folder + 'rules' # Also defined in parse_kconfig
+variable_count_file = build_folder + 'variable_count' # Also defined in parse_kconfig
+fixed_file = build_folder + 'fixed'
+measure_file = build_folder + 'measure'
+dot_measure_file = build_folder + 'dot_measure'
+dot_config_back_file = build_folder + 'dot_config_back'
+single_generated_file = build_folder + 'single_generated'
+measurechecked_file = build_folder + 'measurechecked'
+
+buildroot_config_cyclictest = '/dev/null'
+
+result_folder = 'result/'
+log_folder = 'log/'
+
+## Programs paths
+parse_kconfig = 'scripts/parse_kconfig/parse'
+write_config = 'scripts/write_config/write_config'
+picosat = 'scripts/picosat-959/picosat'
+allconfig = 'scripts/allconfig/allconfig'
+
+#######################################
+absroot = os.path.dirname(os.path.realpath(__file__))
+
+#######################################
+# Override configuration for specified target
+try:
+       target = open(os.path.join(absroot, '.target'), 'r').readline().rstrip()
+       conffile = os.path.join(absroot, 'targets', target, 'conf.py')
+       try:
+               ovconf = importlib.machinery.SourceFileLoader("module.name", conffile).load_module()
+               for name in dir(ovconf):
+                       if not re.match('__*__', name):
+                               vars()[name] = vars(ovconf)[name]
+       except:
+               print("E: Invalid target specifier. Write valid target to .target file.")
+               sys.exit(-99)
+except:
+       print("E: No target specifier. Write target to .target file.")
+       sys.exit(-99)