diff --git a/libs/utils/analysis/cpus_analysis.py b/libs/utils/analysis/cpus_analysis.py index d70e64c60bf1e5f4ba8fa22b6e5cf1ea5ac78358..60d6f3128f4b9c1b272754d739e6fc59f37456f8 100644 --- a/libs/utils/analysis/cpus_analysis.py +++ b/libs/utils/analysis/cpus_analysis.py @@ -211,4 +211,4 @@ class CpusAnalysis(AnalysisModule): figsize=(16, 8)) ax.grid() -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/analysis/eas_analysis.py b/libs/utils/analysis/eas_analysis.py index 26fcfd56cc84210f5491f9d0bafa12ee20bd97ec..cd4870a50251f13efcd08062810bcb2aacfde06c 100644 --- a/libs/utils/analysis/eas_analysis.py +++ b/libs/utils/analysis/eas_analysis.py @@ -398,4 +398,4 @@ class EasAnalysis(AnalysisModule): .format(self._trace.plots_dir, self._trace.plots_prefix) pl.savefig(figname, bbox_inches='tight') -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/analysis/frequency_analysis.py b/libs/utils/analysis/frequency_analysis.py index c29f330fdf76b048b5ab2ba346aab22a5bfa0baf..6d061f9ae2d727b1a165f0af9482de5cb8aeecec 100644 --- a/libs/utils/analysis/frequency_analysis.py +++ b/libs/utils/analysis/frequency_analysis.py @@ -916,4 +916,4 @@ class FrequencyAnalysis(AnalysisModule): entity_name, figtype) pl.savefig(figname, bbox_inches='tight') -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/analysis/functions_analysis.py b/libs/utils/analysis/functions_analysis.py index 7ae3d21f2e51ed4423634d150d36f5db60247053..aeb1e0006bbf107dfa66e628cad1fcd514db44d2 100644 --- a/libs/utils/analysis/functions_analysis.py +++ b/libs/utils/analysis/functions_analysis.py @@ -78,4 +78,4 @@ class FunctionsAnalysis(AnalysisModule): axes.set_ylabel(ylabel) axes.get_xaxis().set_visible(False) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/analysis/idle_analysis.py b/libs/utils/analysis/idle_analysis.py index 2de48901a534de1d37e315890aeda93a8a78fe96..7db521902fb9b0913fdcaed1d86e0bcf59a6aa58 100644 --- a/libs/utils/analysis/idle_analysis.py +++ b/libs/utils/analysis/idle_analysis.py @@ -321,4 +321,4 @@ class IdleAnalysis(AnalysisModule): pl.savefig(figname, bbox_inches='tight') -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/analysis/latency_analysis.py b/libs/utils/analysis/latency_analysis.py index 22e490a14a2e89f478d04cbb0cc09ac42b95a294..86fb2e5b19a9ecafaebaf78facf4be105c69cb2b 100644 --- a/libs/utils/analysis/latency_analysis.py +++ b/libs/utils/analysis/latency_analysis.py @@ -910,4 +910,4 @@ class LatencyAnalysis(AnalysisModule): return CDF(df, threshold, above, below) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/analysis/status_analysis.py b/libs/utils/analysis/status_analysis.py index 823465823dfe1532c10fa3968192690775db53ec..a09f71c0c1cfd69b41e94dcec581af640a14fa0b 100644 --- a/libs/utils/analysis/status_analysis.py +++ b/libs/utils/analysis/status_analysis.py @@ -107,4 +107,4 @@ class StatusAnalysis(AnalysisModule): end = start + delta axes.axvspan(start, end, facecolor='r', alpha=0.1) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/analysis/tasks_analysis.py b/libs/utils/analysis/tasks_analysis.py index 36d126bb05ea324efb8995fa577f44b2724b6969..d34241cd452dd45358145bb568ed32f305c2469e 100644 --- a/libs/utils/analysis/tasks_analysis.py +++ b/libs/utils/analysis/tasks_analysis.py @@ -798,4 +798,4 @@ class TasksAnalysis(AnalysisModule): if 'sched_overutilized' in signals: self._trace.analysis.status.plotOverutilized(axes) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/analysis/thermal_analysis.py b/libs/utils/analysis/thermal_analysis.py index 2c866622199d85484b36cd7438188eea35729d00..93e2b04aa1688a4cb8fe364dbf57533715a4f365 100644 --- a/libs/utils/analysis/thermal_analysis.py +++ b/libs/utils/analysis/thermal_analysis.py @@ -287,4 +287,4 @@ class ThermalAnalysis(AnalysisModule): cpumasks = df['cpus'].unique().tolist() return [m for m in cpumasks if m & global_mask] -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/analysis_module.py b/libs/utils/analysis_module.py index 931e2f880da57dc7c0f06826502a41bd678f766a..c51868dfd353b2ccfc26023fbae220d6ce2d1605 100644 --- a/libs/utils/analysis_module.py +++ b/libs/utils/analysis_module.py @@ -181,4 +181,4 @@ class AnalysisModule(object): return ax -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/analysis_register.py b/libs/utils/analysis_register.py index a42b05936f538ce34d0452457f78b96eb103fca2..ba881a0ddf6a60da4e2cd02bcf04edf07012cb49 100644 --- a/libs/utils/analysis_register.py +++ b/libs/utils/analysis_register.py @@ -73,4 +73,4 @@ class AnalysisRegister(object): setattr(self, module_name, handler(trace)) self._log.debug(' %s', module_name) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/android/benchmark.py b/libs/utils/android/benchmark.py index a33fd68cdb30a772f0a420664e7de27a7478622a..5d81e72b07785f5cc17fe3db28040aeb3b57a3ba 100644 --- a/libs/utils/android/benchmark.py +++ b/libs/utils/android/benchmark.py @@ -399,4 +399,4 @@ class LisaBenchmark(object): return rebooted -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/android/screen.py b/libs/utils/android/screen.py index 6a81395b7b09ec0149a0f7b4779a2ff57847ade8..27cb2ed8c3a4a1a7f87432b2895a094510cc8795 100644 --- a/libs/utils/android/screen.py +++ b/libs/utils/android/screen.py @@ -155,4 +155,4 @@ class Screen(object): System.menu(target) System.home(target) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/android/system.py b/libs/utils/android/system.py index 047c8c4a93a618c25ff59d07d9b1e0360bd4f610..8890eed944a2631723f09a07db2ae29f8a642b27 100644 --- a/libs/utils/android/system.py +++ b/libs/utils/android/system.py @@ -518,4 +518,4 @@ class System(object): return packages return None -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/android/viewer.py b/libs/utils/android/viewer.py index 18ff0f57a083c631a9ff339780aa5bf3e8d49cce..4133ff606f5a5c108542b350c2719ae738159157 100644 --- a/libs/utils/android/viewer.py +++ b/libs/utils/android/viewer.py @@ -149,4 +149,4 @@ class ViewerWorkload(Workload): # Switch back to screen auto rotation Screen.set_orientation(self._target, auto=True) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/android/workload.py b/libs/utils/android/workload.py index 7387f505525c4bdf93405f02a0bf1fb016823dc9..d04fbb9ca1cc9948f460c9ef3193be23717f05ac 100644 --- a/libs/utils/android/workload.py +++ b/libs/utils/android/workload.py @@ -165,4 +165,4 @@ class Workload(object): self._log.warning('No trace collected since last run') -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/android/workloads/exoplayer.py b/libs/utils/android/workloads/exoplayer.py index 595b8e087720f85770a010b35e1e0858b0edd9b2..3dc461b069136dcbf1d273fc2c290f3b2f44f88d 100644 --- a/libs/utils/android/workloads/exoplayer.py +++ b/libs/utils/android/workloads/exoplayer.py @@ -190,4 +190,4 @@ class ExoPlayer(Workload): # Close and clear application System.force_stop(self._target, self.package, clear=True) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/android/workloads/geekbench.py b/libs/utils/android/workloads/geekbench.py index 9480ffd420d5863ffcadb33a50a59dd2ed0439bc..d016d5f7e8dbdad14fe68cbc629afa15af9abe70 100644 --- a/libs/utils/android/workloads/geekbench.py +++ b/libs/utils/android/workloads/geekbench.py @@ -151,4 +151,4 @@ class Geekbench(Workload): # Set brightness back to auto Screen.set_brightness(self._target, auto=True) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/android/workloads/gmaps.py b/libs/utils/android/workloads/gmaps.py index 7294342697a51d8af00ed3d9e3b9d588cc8a3a3c..4fd9732495f6a9c751ac3ad5aae1bc7defba834d 100644 --- a/libs/utils/android/workloads/gmaps.py +++ b/libs/utils/android/workloads/gmaps.py @@ -138,4 +138,4 @@ class GMaps(Workload): # Switch back to screen auto rotation Screen.set_orientation(self._target, auto=True) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/android/workloads/jankbench.py b/libs/utils/android/workloads/jankbench.py index 5d17ded927292095f7d8cf0d96c5c99203632a05..e9c06735340f8b9b1f05c23dabaa08c2282f3420 100644 --- a/libs/utils/android/workloads/jankbench.py +++ b/libs/utils/android/workloads/jankbench.py @@ -188,4 +188,4 @@ class Jankbench(Workload): # Set brightness back to auto Screen.set_brightness(self._target, auto=True) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/android/workloads/pcmark.py b/libs/utils/android/workloads/pcmark.py index 0ddb7dadcd4a15bb8da8b5abaf7546beabc0f4f8..62ffe0b478322fc541da5b695bd61da71b3ae13a 100644 --- a/libs/utils/android/workloads/pcmark.py +++ b/libs/utils/android/workloads/pcmark.py @@ -178,4 +178,4 @@ class PCMark(Workload): # Set brightness back to auto Screen.set_brightness(self._target, auto=True) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/android/workloads/uibench.py b/libs/utils/android/workloads/uibench.py index 3b24030ee235213d4f700f90ce712eca2d7bc0d0..91a69e4f58fac6552e79a81195fae466f613cc69 100755 --- a/libs/utils/android/workloads/uibench.py +++ b/libs/utils/android/workloads/uibench.py @@ -161,4 +161,4 @@ class UiBench(Workload): System.set_airplane_mode(self._target, on=False) Screen.set_brightness(self._target, auto=True) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/android/workloads/vellamo.py b/libs/utils/android/workloads/vellamo.py index c8863e8d2a0be714175262dc7d6d5886dcd7a899..71c71eeaad92ebe6b3a58306cb127586a9248aed 100644 --- a/libs/utils/android/workloads/vellamo.py +++ b/libs/utils/android/workloads/vellamo.py @@ -174,4 +174,4 @@ class Vellamo(Workload): # Set brightness back to auto Screen.set_brightness(self._target, auto=True) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/android/workloads/youtube.py b/libs/utils/android/workloads/youtube.py index cdfbf2d0462207c3fbf5cc7e1088a272ae34a75a..65c82b15ceaa07009d4a1ee0a72120a3888fe0ea 100644 --- a/libs/utils/android/workloads/youtube.py +++ b/libs/utils/android/workloads/youtube.py @@ -112,4 +112,4 @@ class YouTube(Workload): # Set brightness back to auto Screen.set_brightness(self._target, auto=True) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/energy.py b/libs/utils/energy.py index 1027329f65b2e0c1a80dee10c66282ff2ad5461a..2281a4b0f52a8d840b932a877a6c15c24adc8a75 100644 --- a/libs/utils/energy.py +++ b/libs/utils/energy.py @@ -537,4 +537,4 @@ class Gem5EnergyMeter(_DevlibContinuousEnergyMeter): df.index = timeline return df -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/env.py b/libs/utils/env.py index ca025c23800e0081256b4ac14121744695066f63..34eeef148d9a0c4de7c834e97f9edb13a4002f97 100644 --- a/libs/utils/env.py +++ b/libs/utils/env.py @@ -15,7 +15,7 @@ # limitations under the License. # -import datetime +from datetime import datetime import json import logging import os @@ -64,16 +64,20 @@ class TestEnv(ShareState): want to use to run the experiments - a test configuration (test_conf) defining which SW setups we need on that HW target - - a folder to collect the experiments results, which can be specified - using the test_conf::results_dir option and is by default wiped from - all the previous contents (if wipe=True) + - a folder to collect the experiments results, which can be specified using + the target_conf::results_dir option, or using LISA_RESULTS_DIR environment + variable and is by default wiped from all the previous contents + (if wipe=True) :param target_conf: Configuration defining the target to run experiments on. May be - A dict defining the values directly - A path to a JSON file containing the configuration - - ``None``, in which case $LISA_HOME/target.config is used. + - ``None``, in which case: + - LISA_TARGET_CONF environment variable is read to locate a + config file. + - If the variable is not set, $LISA_HOME/target.config is used. You need to provide the information needed to connect to the target. For SSH targets that means "host", "username" and @@ -105,6 +109,9 @@ class TestEnv(ShareState): target. LISA does *not* manage this TFTP server, it must be provided externally. Optional. + **results_dir** + location of results of the experiments. + :param test_conf: Configuration of software for target experiments. Takes the same form as target_conf. Fields are: @@ -137,9 +144,6 @@ class TestEnv(ShareState): buffsize Size of buffer. Default is 10240. - **results_dir** - location of results of the experiments - :param wipe: set true to cleanup all previous content from the output folder :type wipe: bool @@ -200,11 +204,14 @@ class TestEnv(ShareState): self._log.info('Loading custom (inline) target configuration') self.conf = target_conf elif isinstance(target_conf, str): - self._log.info('Loading custom (file) target configuration') + self._log.info('Loading %s target configuration', target_conf) + self.conf = self.loadTargetConfig(target_conf) + else: + target_conf = os.environ.get('LISA_TARGET_CONF', '') + self._log.info('Loading [%s] target configuration', + target_conf or 'default') self.conf = self.loadTargetConfig(target_conf) - elif target_conf is None: - self._log.info('Loading default (file) target configuration') - self.conf = self.loadTargetConfig() + self._log.debug('Target configuration %s', self.conf) # Setup test configuration @@ -239,17 +246,22 @@ class TestEnv(ShareState): if '__features__' not in self.conf: self.conf['__features__'] = [] - # Initialize local results folder - # test configuration overrides target one - self.res_dir = (self.test_conf.get('results_dir') or - self.conf.get('results_dir')) + # Initialize local results folder. + # The test configuration overrides the target's one and the environment + # variable overrides everything else. + self.res_dir = ( + os.getenv('LISA_RESULTS_DIR') or + self.conf.get('results_dir') + ) + # Default result dir based on the current time + if not self.res_dir: + self.res_dir = datetime.now().strftime( + os.path.join(basepath, OUT_PREFIX, '%Y%m%d_%H%M%S') + ) - if self.res_dir and not os.path.isabs(self.res_dir): - self.res_dir = os.path.join(basepath, 'results', self.res_dir) - else: - self.res_dir = os.path.join(basepath, OUT_PREFIX) - self.res_dir = datetime.datetime.now()\ - .strftime(self.res_dir + '/%Y%m%d_%H%M%S') + # Relative paths are interpreted as relative to a fixed root. + if not os.path.isabs(self.res_dir): + self.res_dir = os.path.join(basepath, OUT_PREFIX, self.res_dir) if wipe and os.path.exists(self.res_dir): self._log.warning('Wipe previous contents of the results folder:') @@ -281,7 +293,7 @@ class TestEnv(ShareState): self._initialized = True - def loadTargetConfig(self, filepath='target.config'): + def loadTargetConfig(self, filepath=None): """ Load the target configuration from the specified file. @@ -291,6 +303,9 @@ class TestEnv(ShareState): """ + # "" and None are replaced by the default 'target.config' value + filepath = filepath or 'target.config' + # Loading default target configuration conf_file = os.path.join(basepath, filepath) @@ -1086,4 +1101,4 @@ IFCFG_BCAST_RE = re.compile( r'Bcast:(.*) ' ) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/executor.py b/libs/utils/executor.py index bacc26a22af2f39ef1aed379ecb9c287b5b46e2d..2a3c2e683dd740d4b8d35004daaf1c4f9be45aa3 100644 --- a/libs/utils/executor.py +++ b/libs/utils/executor.py @@ -803,4 +803,4 @@ FMT_HEADER = r'{:=<80}'.format('') FMT_TITLE = r'{:~<80}'.format('') FMT_FOOTER = r'{:-<80}'.format('') -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/git.py b/libs/utils/git.py index 6a9e07c33054025ca85a446f1cb771bf8deac365..879338e903f3af62841620af871410f1d3c18d14 100644 --- a/libs/utils/git.py +++ b/libs/utils/git.py @@ -55,4 +55,4 @@ class Git(object): return min(possibles, key=len) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/test.py b/libs/utils/test.py index 29e29051eba415f69f275cb843f7e300dc643226..d3c30928bee49b37ff98046e9af68c8df18ffc17 100644 --- a/libs/utils/test.py +++ b/libs/utils/test.py @@ -271,11 +271,13 @@ experiment_test.__test__ = False # runExperiments, so that if the value is invalid we print the error # immediately instead of going ahead with target setup etc. try: - ITERATIONS_FROM_CMDLINE = int( - os.getenv('LISA_TEST_ITERATIONS', '0')) + iterations = os.getenv('LISA_TEST_ITERATIONS') + # Empty string or 0 will be replaced by 0, otherwise converted to int + ITERATIONS_FROM_CMDLINE = int(iterations) if iterations else 0 + if ITERATIONS_FROM_CMDLINE < 0: raise ValueError('Cannot be negative') except ValueError as e: raise ValueError("Couldn't read iterations count: {}".format(e)) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/libs/utils/trace.py b/libs/utils/trace.py index 57a6957692ca3c155c8a75d939c2bd0c29259fe3..b4aeaff98edb42e8cea2ad48621c62052b627069 100644 --- a/libs/utils/trace.py +++ b/libs/utils/trace.py @@ -879,4 +879,4 @@ class TraceData: """ A DataFrame collector exposed to Trace's clients """ pass -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/src/shell/lisa_colors b/src/shell/lisa_colors index 2b4a7fdf0936d5714b0955438e3ed060bc164925..e86eca2d2330edc9024cfb1989fbdac75dcacaaa 100644 --- a/src/shell/lisa_colors +++ b/src/shell/lisa_colors @@ -32,24 +32,27 @@ # cyan 36 46 # white 37 47 -LISASHELL_WHITE="\033[1;37m" -LISASHELL_LGRAY="\033[37m" -LISASHELL_GRAY="\033[1;30m" -LISASHELL_BLACK="\033[30m" -LISASHELL_RED="\033[31m" -LISASHELL_LRED="\033[1;31m" -LISASHELL_GREEN="\033[32m" -LISASHELL_LGREEN="\033[1;32m" -LISASHELL_BROWN="\033[33m" -LISASHELL_YELLOW="\033[1;33m" -LISASHELL_BLUE="\033[34m" -LISASHELL_LBLUE="\033[1;34m" -LISASHELL_PURPLE="\033[35m" -LISASHELL_PINK="\033[1;35m" -LISASHELL_CYAN="\033[36m" -LISASHELL_LCYAN="\033[1;36m" +if [[ -t 1 ]]; then + LISASHELL_WHITE="\033[1;37m" + LISASHELL_LGRAY="\033[37m" + LISASHELL_GRAY="\033[1;30m" + LISASHELL_BLACK="\033[30m" + LISASHELL_RED="\033[31m" + LISASHELL_LRED="\033[1;31m" + LISASHELL_GREEN="\033[32m" + LISASHELL_LGREEN="\033[1;32m" + LISASHELL_BROWN="\033[33m" + LISASHELL_YELLOW="\033[1;33m" + LISASHELL_BLUE="\033[34m" + LISASHELL_LBLUE="\033[1;34m" + LISASHELL_PURPLE="\033[35m" + LISASHELL_PINK="\033[1;35m" + LISASHELL_CYAN="\033[36m" + LISASHELL_LCYAN="\033[1;36m" + LISASHELL_RESET="\033[0m" + LISASHELL_DEFAULT=$LISASHELL_WHITE + LISASHELL_HELP="\033[42m" + LISASHELL_BANNER="\033[44m" +fi -LISASHELL_RESET="\033[0m" -LISASHELL_DEFAULT=$LISASHELL_WHITE - -# vim: set tabstop=4: +# vim :set tabstop=4 shiftwidth=4 textwidth=80 expandtab diff --git a/src/shell/lisa_shell b/src/shell/lisa_shell index b96f2434a426ee7aa7d2631457100c662624528e..62cd563227d8415e5990eb124fca9c176c662045 100755 --- a/src/shell/lisa_shell +++ b/src/shell/lisa_shell @@ -1,3 +1,4 @@ +#! /bin/bash # # SPDX-License-Identifier: Apache-2.0 # @@ -33,11 +34,21 @@ export PYTHONPATH=$LISA_HOME/libs/wlgen:$PYTHONPATH export PYTHONPATH=$LISA_HOME:$PYTHONPATH if [ "x$DEVMODE" == "x1" ]; then - export PYTHONPATH=$LISA_HOME/libs/devlib:$PYTHONPATH - export PYTHONPATH=$LISA_HOME/libs/trappy:$PYTHONPATH - export PYTHONPATH=$LISA_HOME/libs/bart:$PYTHONPATH + export PYTHONPATH=$LISA_HOME/libs/devlib:$PYTHONPATH + export PYTHONPATH=$LISA_HOME/libs/trappy:$PYTHONPATH + export PYTHONPATH=$LISA_HOME/libs/bart:$PYTHONPATH fi +################################################################################ +# Helpers +################################################################################ + +# Only clear the screen if stdout is a terminal, to avoid ASCII escape +# characters to be sent to a log file for example. +function clear { +test -t 1 && command clear +} + ################################################################################ # Generic LISA Shell commands ################################################################################ @@ -45,7 +56,7 @@ fi # LISA Shell On-Line HELP function lisa-help { clear -echo -ne '\E[37;42m' +echo -e "$LISASHELL_HELP" echo " " echo " .:: LISA Shell - HELP On-Line ::. " echo " " @@ -60,6 +71,7 @@ cat </dev/null | \ - awk '/inet / {print $2}' | \ - sed 's/addr://') + awk '/inet / {print $2}' | \ + sed 's/addr://') if [ "x$IPADDR" == "x" ]; then echo echo "$NETIF is not a valid network interface" @@ -197,10 +209,10 @@ URL="http://$IPADDR:$PORT/?token=$TOKEN" # Check if an instance is already running if [ -f "$PIDFILE" ] && pgrep -F $PIDFILE >/dev/null; then - echo "Server already running:" + echo "Server already running:" echo " " $(cat $URLFILE) xdg-open $(cat $URLFILE) - return 1 + return 1 fi # Start the server bindeed to the specified interface @@ -231,7 +243,7 @@ function _lisa-ipython-stop { PYDIR="$LISA_HOME/ipynb" PIDFILE="$PYDIR/server.pid" if [ -f "$PIDFILE" ] && pgrep -F $PIDFILE >/dev/null; then - kill $(<$PIDFILE) 2>/dev/null + kill $(<$PIDFILE) 2>/dev/null fi rm -f $PIDFILE 2>/dev/null } @@ -251,16 +263,16 @@ PORT=${3:-8888} echo case "x${CMD^^}" in 'xSTART') - echo "Starting IPython Notebooks..." - _lisa-ipython-start $NETIF $PORT - ;; + echo "Starting IPython Notebooks..." + _lisa-ipython-start $NETIF $PORT + ;; 'xSTOP') - echo "Stopping IPython Notebooks..." - _lisa-ipython-stop - ;; + echo "Stopping IPython Notebooks..." + _lisa-ipython-stop + ;; "xHELP"|*) - _lisa-ipython-usage - ;; + _lisa-ipython-usage + ;; esac echo echo @@ -270,8 +282,8 @@ function lisa-check-submods { if [ ! -f ./libs/devlib/setup.py ] || [ ! -f ./libs/bart/setup.py ] || [ ! -f ./libs/trappy/setup.py ]; then - echo "One or more submodules missing, updating"; - lisa-update submodules + echo "One or more submodules missing, updating"; + lisa-update submodules fi } @@ -281,13 +293,22 @@ fi function _lisa-test-usage { cat </dev/null if [ $? -ne 0 ]; then cat < pip install virtualenv + Please install virtualenv before running this command. + You can install it on Ubuntu systems with: + $> pip install virtualenv EOF - return -1 + return -1 fi # Create and activate a python's virtual environment to be used for the @@ -435,26 +477,26 @@ function lisa-wltest-series { if [ -z $ANDROID_HOME ]; then cat </dev/null if [ $? -ne 0 ]; then - cat < sudo apt-get install coreutils + You can install it on Ubuntu systems with: + $> sudo apt-get install coreutils EOF - return -1 + return -1 fi # Ensure the wltest environment has been configured, and get the relative @@ -482,7 +524,7 @@ PS1="\[${LISASHELL_BLUE}\][LISAShell \[${LISASHELL_LCYAN}\]\W\[${LISASHELL_BLUE} # Dump out a nice LISA Shell logo clear -echo -e '\E[37;44m' +echo -e "$LISASHELL_BANNER" echo " " echo " .:: LISA Shell ::. " @@ -492,6 +534,7 @@ cat <= 1) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/tests/benchmarks/android_gmaps.py b/tests/benchmarks/android_gmaps.py index f13a4ef812c9b60566b02de3d229d053274bde7c..4b718b5b0e9ce0a5217b60a5fddc17ded5e4fff9 100755 --- a/tests/benchmarks/android_gmaps.py +++ b/tests/benchmarks/android_gmaps.py @@ -125,4 +125,4 @@ for governor in governors: # We want to collect data from at least one governor assert(tests_completed >= 1) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/tests/benchmarks/android_jankbench.py b/tests/benchmarks/android_jankbench.py index 3a87f86595c784a79edd48369510386f91144821..9d14a4a85ba996a4593fdd3899869f084508c745 100755 --- a/tests/benchmarks/android_jankbench.py +++ b/tests/benchmarks/android_jankbench.py @@ -130,4 +130,4 @@ for governor in governors: # We want to collect data from at least one governor assert(tests_completed >= 1) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/tests/benchmarks/android_uibench.py b/tests/benchmarks/android_uibench.py index 541211a07296d7a0b33807697cfcbf733acf1d3b..0d3f761de69a39af1b3ca7647a34d92cea5e3be3 100755 --- a/tests/benchmarks/android_uibench.py +++ b/tests/benchmarks/android_uibench.py @@ -142,4 +142,4 @@ for governor in governors: # We want to collect data from at least one governor assert(tests_completed >= 1) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/tests/benchmarks/android_vellamo.py b/tests/benchmarks/android_vellamo.py index 6a13f0aa6b73ae551140739f21c4dd45028fe040..4d33ab37327f539b0240ac9963c6f0975cb28d65 100755 --- a/tests/benchmarks/android_vellamo.py +++ b/tests/benchmarks/android_vellamo.py @@ -123,4 +123,4 @@ for governor in governors: # We want to collect data from at least one governor assert(tests_completed >= 1) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/tests/benchmarks/android_youtube.py b/tests/benchmarks/android_youtube.py index ffb3d409eb837fb846d3c48be7254e3e46be35d8..34085502aada912e9e6aa7194281d991c827b08a 100755 --- a/tests/benchmarks/android_youtube.py +++ b/tests/benchmarks/android_youtube.py @@ -124,4 +124,4 @@ for governor in governors: # We want to collect data from at least one governor assert(tests_completed >= 1) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/tests/eas/generic.py b/tests/eas/generic.py index 252b791629d7d51dc9a7b87f1f1a8ff0415c0fa0..07e107ca1ed7f154e7df03fc1886123842725619 100644 --- a/tests/eas/generic.py +++ b/tests/eas/generic.py @@ -355,7 +355,7 @@ class _EnergyModelTest(LisaTest): Use :meth:get_expected_power_df and :meth:get_power_df to estimate optimal and observed power usage for task placements of the experiment's workload. Assert that the observed power does not exceed the optimal - power by more than 20%. + power by more than :attr:energy_est_threshold_pct percents. """ exp_power = self.get_expected_power_df(experiment) est_power = self.get_power_df(experiment) @@ -496,7 +496,7 @@ class TwoBigThreeSmall(_EnergyModelTest): class RampUp(_EnergyModelTest): """ - Test EAS for a task ramping from 5% up to 70% over 2 seconds + Test EAS for a task ramping from 5% up to 70% """ workloads = { "ramp_up" : { diff --git a/tests/eas/load_tracking.py b/tests/eas/load_tracking.py index 96f5b0d9507cf6f946fb7f5231abfdc1e0bcfcb6..379aada1d261a2cf87b68a15c28636b47e4bb700 100644 --- a/tests/eas/load_tracking.py +++ b/tests/eas/load_tracking.py @@ -164,7 +164,7 @@ class _LoadTrackingBase(LisaTest): elif 'sched_pelt_se' in trace.available_events: event = 'sched_pelt_se' else: - raise ValueError('No sched_load_avg_task or sched_pelt_se events. ' + raise ValueError('No sched_load_avg_task or sched_load_se or sched_pelt_se events. ' 'Does the kernel support them?') df = getattr(trace.ftrace, event).data_frame diff --git a/tests/eas/preliminary.py b/tests/eas/preliminary.py index e9e4c19bc8f5dfe0f6503837c9ff4a2a5588b7e7..2aa6d60994d98a6cba92ee4ba7829c09515a4212 100644 --- a/tests/eas/preliminary.py +++ b/tests/eas/preliminary.py @@ -51,7 +51,6 @@ All required config options are set, sched governor is present. TEST_CONF = { 'modules': ['cpufreq'], - 'results_dir': 'PreliminaryTests', 'tools': [ 'sysbench', ] diff --git a/tests/eas/rfc.py b/tests/eas/rfc.py index 7911b6a045b6c12c0f3f27edb454ca3250e317cb..d55f8bc82e7a1f4230b5da153f512c0b145324be 100644 --- a/tests/eas/rfc.py +++ b/tests/eas/rfc.py @@ -37,4 +37,4 @@ class RFC(LisaTest): """A dummy test just to run configured workloads""" pass -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/tests/lisa/test_executor.py b/tests/lisa/test_executor.py index 910e9c11ad0c6d82243261e709b69c6a3768adac..0745d4b64061b9d2cdd9578d76ea1f44a149eb94 100644 --- a/tests/lisa/test_executor.py +++ b/tests/lisa/test_executor.py @@ -38,7 +38,6 @@ class SetUpTarget(TestCase): 'rtapp-calib': {c: 100 for c in range(64)} }, test_conf={ - 'results_dir': self.res_dir, # Don't load cpufreq, it won't work when platform=host 'exclude_modules': ['cpufreq'], }, @@ -50,10 +49,8 @@ class TestMagicSmoke(SetUpTarget): conf_name = 'myconf' wl_name = 'mywl' - results_dir = os.path.join(self.te.LISA_HOME, 'results', self.res_dir, + results_dir = os.path.join(self.te.res_dir, 'rtapp:{}:{}'.format(conf_name, wl_name)) - if os.path.isdir(results_dir): - shutil.rmtree(results_dir) experiments_conf = { 'confs': [{ diff --git a/tests/sfreq/smoke_test.py b/tests/sfreq/smoke_test.py index f63a08274b927e683440f2ed3c38f9412c4172c1..cc091e384a508b2f866f5f93860554fd2f1a1889 100644 --- a/tests/sfreq/smoke_test.py +++ b/tests/sfreq/smoke_test.py @@ -37,4 +37,4 @@ class SFreq(LisaTest): """Check that there is not regression on energy""" # TODO -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80 diff --git a/tests/stune/smoke_test_ramp.py b/tests/stune/smoke_test_ramp.py index d34c0275b9310cd96703ecb775bd2ad2db9b493c..4331f7033ffbe94e9aadad9981117c14b0f799d1 100644 --- a/tests/stune/smoke_test_ramp.py +++ b/tests/stune/smoke_test_ramp.py @@ -100,4 +100,4 @@ class STune(LisaTest): .format(boost / 100.) self.assertTrue(analyzer.assertStatement(statement), msg=error_msg) -# vim :set tabstop=4 shiftwidth=4 expandtab +# vim :set tabstop=4 shiftwidth=4 expandtab textwidth=80