diff --git a/ipynb/tests/EAS_Integration_Tests.ipynb b/ipynb/tests/EAS_Integration_Tests.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..f715974723463ba8a3fb7aef9104cc7380441b29 --- /dev/null +++ b/ipynb/tests/EAS_Integration_Tests.ipynb @@ -0,0 +1,1045 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# EAS Integration Tests\n", + "\n", + "We use this notebook to test EAS integration branches on three different platforms:\n", + "\n", + "- Juno\n", + "- Hikey 620\n", + "- TC2\n", + "\n", + "These are basic tests to check that EAS-related features are in place. It is assumed that the kernel has been built for each platform and has correctly booted. Tests are the following:\n", + "\n", + "1. Printing kernel version\n", + "+ All CPUs are up and running\n", + "+ All sched domains are present\n", + "+ The energy model is present\n", + "+ Check that the proper sched domain flags are enabled\n", + "+ EAS-related config options are there\n", + "+ cpufreq is present\n", + "+ cpuidle is present\n", + "+ utilest is available among the SCHED_FEATURES" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true, + "run_control": { + "marked": false + } + }, + "outputs": [], + "source": [ + "import logging\n", + "from conf import LisaLogging\n", + "LisaLogging.setup(level=logging.INFO)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "run_control": { + "marked": false + } + }, + "outputs": [], + "source": [ + "%matplotlib inline\n", + "\n", + "# Support to access the remote target\n", + "import devlib\n", + "from env import TestEnv\n", + "\n", + "import pandas as pd" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Expected Data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "configs = [\n", + " 'CONFIG_ARM_BIG_LITTLE_CPUFREQ',\n", + " 'CONFIG_CGROUPS',\n", + " 'CONFIG_CPU_FREQ',\n", + " 'CONFIG_CPU_FREQ_STAT',\n", + " 'CONFIG_CPU_FREQ_GOV_SCHEDUTIL',\n", + " 'CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL',\n", + " 'CONFIG_SCHED_DEBUG',\n", + " 'CONFIG_FUNCTION_TRACER',\n", + " 'CONFIG_IRQSOFF_TRACER',\n", + " 'CONFIG_CPU_IDLE',\n", + " 'CONFIG_SCHEDSTATS',\n", + " 'CONFIG_SCHED_TRACER',\n", + " 'CONFIG_SCHED_MC',\n", + " 'CONFIG_FTRACE',\n", + " 'CONFIG_CGROUPS',\n", + " 'CONFIG_CGROUP_FREEZER',\n", + "]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "energy_model = {\n", + " 'juno': {\n", + " # sched domains (on CPU0)\n", + " 0: {\n", + " # sched groups (on CPU0)\n", + " 0: {\n", + " 'cap_states': [(276, 37), (501, 59), (593, 117)],\n", + " 'idle_states': [33, 33, 0, 0]\n", + " },\n", + " 1: {\n", + " 'cap_states': [(276, 37), (501, 59), (593, 117)],\n", + " 'idle_states': [33, 33, 0, 0]\n", + " },\n", + " 2: {\n", + " 'cap_states': [(276, 37), (501, 59), (593, 117)],\n", + " 'idle_states': [33, 33, 0, 0]\n", + " },\n", + " 3: {\n", + " 'cap_states': [(276, 37), (501, 59), (593, 117)],\n", + " 'idle_states': [33, 33, 0, 0]\n", + " },\n", + " },\n", + " 1: {\n", + " 0: {\n", + " 'cap_states': [(276, 41), (501, 86), (593, 107)],\n", + " 'idle_states': [41, 41, 41, 14]\n", + " },\n", + " 1: {\n", + " 'cap_states': [(501, 48), (849, 73), (1024, 107)],\n", + " 'idle_states': [48, 48, 48, 18]\n", + " }\n", + " }\n", + " },\n", + " 'hikey': {\n", + " 0: {\n", + " 0: {\n", + " 'cap_states': [(178, 69), (369, 125), (622, 224), (819, 367), (1024, 670)],\n", + " 'idle_states': [15, 15, 0, 0]\n", + " },\n", + " 1: {\n", + " 'cap_states': [(178, 69), (369, 125), (622, 224), (819, 367), (1024, 670)],\n", + " 'idle_states': [15, 15, 0, 0]\n", + " },\n", + " 2: {\n", + " 'cap_states': [(178, 69), (369, 125), (622, 224), (819, 367), (1024, 670)],\n", + " 'idle_states': [15, 15, 0, 0]\n", + " },\n", + " 3: {\n", + " 'cap_states': [(178, 69), (369, 125), (622, 224), (819, 367), (1024, 670)],\n", + " 'idle_states': [15, 15, 0, 0]\n", + " },\n", + " },\n", + " 1: {\n", + " 0: {\n", + " 'cap_states': [(178, 16), (369, 29), (622, 47), (819, 75), (1024, 112)],\n", + " 'idle_states': [107, 107, 47, 0]\n", + " },\n", + " 1: {\n", + " 'cap_states': [(178, 16), (369, 29), (622, 47), (819, 75), (1024, 112)],\n", + " 'idle_states': [107, 107, 47, 0]\n", + " }, \n", + " },\n", + " 2: {\n", + " 0: {\n", + " 'cap_states': [(1024, 0)],\n", + " 'idle_states': [0, 0, 0, 0]\n", + " },\n", + " },\n", + " },\n", + " 'tc2': {\n", + " 0: {\n", + " 0: {\n", + " 'cap_states': [(426, 2021), (512, 2312), (597, 2756), (682, 3125),\n", + " (768, 3524), (853, 3846), (938, 5177), (1024, 6997)],\n", + " 'idle_states': [0, 0, 0]\n", + " },\n", + " 1: {\n", + " 'cap_states': [(426, 2021), (512, 2312), (597, 2756), (682, 3125),\n", + " (768, 3524), (853, 3846), (938, 5177), (1024, 6997)],\n", + " 'idle_states': [0, 0, 0]\n", + " },\n", + " },\n", + " 1: {\n", + " 0: {\n", + " 'cap_states': [(426, 7920), (512, 8165), (597, 8172), (682, 8195),\n", + " (768, 8265), (853, 8446), (938, 11426), (1024, 15200)],\n", + " 'idle_states': [70, 70, 25]\n", + " },\n", + " 1: {\n", + " 'cap_states': [(150, 2967), (172, 2792), (215, 2810), (258, 2815),\n", + " (301, 2919), (344, 2847), (387, 3917), (430, 4905)],\n", + " 'idle_states': [25, 25, 10]\n", + " }, \n", + " },\n", + " },\n", + " 'hikey960': {\n", + " 0: {\n", + " 0: {\n", + " 'cap_states': [(133, 87), (250, 164), (351, 265), (429, 388), (462, 502)],\n", + " 'idle_states': [5, 5, 0, 0]\n", + " },\n", + " 1: {\n", + " 'cap_states': [(133, 87), (250, 164), (351, 265), (429, 388), (462, 502)],\n", + " 'idle_states': [5, 5, 0, 0]\n", + " },\n", + " 2: {\n", + " 'cap_states': [(133, 87), (250, 164), (351, 265), (429, 388), (462, 502)],\n", + " 'idle_states': [5, 5, 0, 0]\n", + " },\n", + " 3: {\n", + " 'cap_states': [(133, 87), (250, 164), (351, 265), (429, 388), (462, 502)],\n", + " 'idle_states': [5, 5, 0, 0]\n", + " },\n", + " },\n", + " 1: {\n", + " 0: {\n", + " 'cap_states': [(133, 12), (250, 22), (351, 36), (429, 67), (462, 144)],\n", + " 'idle_states': [12, 12, 12, 0]\n", + " },\n", + " 1: {\n", + " 'cap_states': [(390, 102), (615, 124), (782, 221), (915, 330), (1024, 433)],\n", + " 'idle_states': [102, 102, 102, 102, 0]\n", + " }\n", + " }\n", + " },\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sched_domains = {\n", + " 'juno': ['MC', 'DIE'],\n", + " 'hikey': ['SYS', 'MC', 'DIE'],\n", + " 'tc2': ['MC', 'DIE'],\n", + " 'hikey960': ['MC', 'DIE'],\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "cpus = {\n", + " 'juno': ['0xd03', '0xd08', '0xd08', '0xd03', '0xd03', '0xd03'],\n", + " 'hikey': ['0xd03', '0xd03', '0xd03', '0xd03', '0xd03', '0xd03', '0xd03', '0xd03'],\n", + " 'tc2': ['0xc0f', '0xc0f', '0xc07', '0xc07', '0xc07'],\n", + " 'hikey960': ['0xd03', '0xd03', '0xd03', '0xd03', '0xd09', '0xd09', '0xd09', '0xd09'],\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Sched domain flags\n", + "SD_LOAD_BALANCE = 0x0001\n", + "SD_BALANCE_NEWIDLE = 0x0002\n", + "SD_BALANCE_EXEC = 0x0004\n", + "SD_BALANCE_FORK = 0x0008\n", + "SD_BALANCE_WAKE = 0x0010\n", + "SD_WAKE_AFFINE = 0x0020\n", + "SD_ASYM_CPUCAPACITY = 0x0040\n", + "SD_SHARE_CPUCAPACITY = 0x0080\n", + "SD_SHARE_POWERDOMAIN = 0x0100\n", + "SD_SHARE_PKG_RESOURCES = 0x0200\n", + "SD_SERIALIZE = 0x0400\n", + "SD_ASYM_PACKING = 0x0800\n", + "SD_PREFER_SIBLING = 0x1000\n", + "SD_OVERLAP = 0x2000\n", + "SD_NUMA = 0x4000\n", + "SD_SHARE_CAP_STATES = 0x8000" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Sched domain flags for big.LITTLE platforms\n", + "sd_flags_bl = {\n", + " 0: (SD_LOAD_BALANCE | SD_BALANCE_NEWIDLE | SD_WAKE_AFFINE | SD_PREFER_SIBLING | SD_BALANCE_EXEC |\n", + " SD_BALANCE_FORK | SD_BALANCE_WAKE | SD_SHARE_PKG_RESOURCES | SD_SHARE_CAP_STATES),\n", + " 1: (SD_LOAD_BALANCE | SD_BALANCE_NEWIDLE | SD_WAKE_AFFINE | SD_PREFER_SIBLING | SD_BALANCE_EXEC |\n", + " SD_BALANCE_FORK | SD_ASYM_CPUCAPACITY | SD_BALANCE_WAKE)\n", + "}\n", + "\n", + "sd_flags_smp = {\n", + " 0: (SD_LOAD_BALANCE | SD_BALANCE_NEWIDLE | SD_WAKE_AFFINE | SD_PREFER_SIBLING | SD_BALANCE_EXEC |\n", + " SD_BALANCE_FORK | SD_SHARE_PKG_RESOURCES),\n", + " 1: (SD_LOAD_BALANCE | SD_BALANCE_NEWIDLE | SD_WAKE_AFFINE | SD_PREFER_SIBLING | SD_BALANCE_EXEC |\n", + " SD_BALANCE_FORK | SD_SHARE_CAP_STATES),\n", + " 2: (SD_WAKE_AFFINE | SD_BALANCE_NEWIDLE | SD_PREFER_SIBLING | SD_BALANCE_EXEC | SD_BALANCE_FORK),\n", + "}\n", + "\n", + "# Expected sched domain flags\n", + "sd_flags = {\n", + " 'juno': sd_flags_bl,\n", + " 'hikey': sd_flags_smp,\n", + " 'tc2': sd_flags_bl,\n", + " 'hikey960': sd_flags_bl,\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Number of frequency domains in each platform\n", + "# This should correspond to the number of cpufreq policies\n", + "frequency_domains = {\n", + " 'juno': 2,\n", + " 'hikey': 1,\n", + " 'tc2': 2,\n", + " 'hikey960': 2,\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "idle_states = {\n", + " 'juno': 3,\n", + " 'hikey': 3,\n", + " 'tc2': 2,\n", + " 'hikey960': 3,\n", + "}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Test Methods" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "W = '\\033[0m' # white (normal)\n", + "R = '\\033[31m' # red\n", + "G = '\\033[32m' # green" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def check_config(te, platform): \n", + " print \"Kernel Config\"\n", + " print \"===========\"\n", + " \n", + " config_path = '/proc/config.gz'\n", + " if not te.target.file_exists(config_path):\n", + " print R + \"FAILURE\" + W\n", + " print \"Missing {} file\".format(config_path)\n", + " print \"Is the option enabled in the config?\"\n", + " return\n", + " \n", + " all_enabled = True\n", + " for c in configs:\n", + " if not te.target.config.is_enabled(c):\n", + " all_enabled = False\n", + " print \"{} option NOT ENABLED\".format(c)\n", + "\n", + " if all_enabled:\n", + " print G + \"OK\" + W\n", + " else:\n", + " print R + \"FAILURE\" + W\n", + " print \"Missing options in .config\"\n", + " print \"\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def check_sched_domains(te, platform):\n", + " print \"Sched Domains\"\n", + " print \"=============\"\n", + " sd = te.target.execute('cat /proc/sys/kernel/sched_domain/cpu0/domain*/name').split()\n", + " if set(sd) == set(sched_domains[platform]):\n", + " print G + \"OK\" + W\n", + " else:\n", + " print R + \"FAILURE\" + W\n", + " print \"Some sched domaind do not correspond to the expected ones\"\n", + " print \"Expected: {}\".format(sched_domains[platform])\n", + " print \"Read from target: {}\".format(sd)\n", + " print \"\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def check_cpu_parts(te, platform):\n", + " print \"CPU parts\"\n", + " print \"============\"\n", + " c = te.target.execute('cat /proc/cpuinfo | grep \"^CPU part\" | cut -d\" \" -f3').split('\\r\\n')[:-1]\n", + " if c == cpus[platform]:\n", + " print G + \"OK\" + W\n", + " else:\n", + " print R + \"FAILURE\" + W\n", + " print \"Some CPU parts do not correspond to the expected ones\", \"red\"\n", + " print \"Expected: {}\".format(cpus[platform]), \"red\"\n", + " print \"Read from target: {}\".format(c)\n", + " print \"\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def check_energy_model(te, platform):\n", + " print \"Energy Model\"\n", + " print \"============\"\n", + " nrg_model = energy_model[platform]\n", + " error = False\n", + " for sd in nrg_model:\n", + " for sg in nrg_model[sd]:\n", + " cap_states = te.target.execute(\n", + " 'cat /proc/sys/kernel/sched_domain/cpu0/domain{}/group{}/energy/cap_states'.format(sd, sg)\n", + " ).split()\n", + " cap_states = [int(c) for c in cap_states]\n", + " cap_states = zip(cap_states[::2], cap_states[1::2])\n", + " idle_states = te.target.execute(\n", + " 'cat /proc/sys/kernel/sched_domain/cpu0/domain{}/group{}/energy/idle_states'.format(sd, sg)\n", + " ).split()\n", + " idle_states = [int(i) for i in idle_states]\n", + " if cap_states != nrg_model[sd][sg]['cap_states']:\n", + " print \"Sched domain {}, sched group {} shows wrong cap_states\".format(sd, sg)\n", + " print \"Expected: {}\".format(nrg_model[sd][sg]['cap_states'])\n", + " print \"Read from target: {}\".format(cap_states)\n", + " error = True\n", + " if idle_states != nrg_model[sd][sg]['idle_states']:\n", + " print \"Sched domain {}, sched group {} shows wrong idle_states\".format(sd, sg)\n", + " print \"Expected: {}\".format(nrg_model[sd][sg]['idle_states'])\n", + " print \"Read from target: {}\".format(idle_states)\n", + " error = True\n", + "\n", + " if error:\n", + " print R + \"FAILURE\" + W\n", + " else:\n", + " print G + \"OK\" + W\n", + " print \"\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def check_sched_domain_flags(te, platform):\n", + " ta_flags = te.target.execute('cat /proc/sys/kernel/sched_domain/cpu0/domain*/flags').split()\n", + " ta_flags = [int(f) for f in ta_flags]\n", + "\n", + " print \"Sched Domain Flags\"\n", + " print \"============\"\n", + " error = False\n", + " for i, flag in enumerate(ta_flags):\n", + " if sd_flags[platform][i] != flag:\n", + " error = True\n", + " print \"Sched Domain {}\".format(i)\n", + " print \"Expected {}, read {}\".format(sd_flags[platfom][i], flag)\n", + "\n", + " if error:\n", + " print R + \"FAILURE\" + W\n", + " else:\n", + " print G + \"OK\" + W\n", + " print \"\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def check_cpufreq_policies(te, platform):\n", + " print \"cpufreq Policies\"\n", + " print \"===========\"\n", + " n_policies = int(te.target.execute('ls -l /sys/devices/system/cpu/cpufreq/ | grep policy | wc -l'))\n", + " if n_policies == frequency_domains[platform]:\n", + " print G + \"OK\" + W\n", + " else:\n", + " print R + \"FAILURE\" + W\n", + " print \"Number of cpufreq policies does not match number of frequency domains\"\n", + " print \"Expected: {}\".format(frequency_domains[platform])\n", + " print \"Read from target: {}\".format(n_policies)\n", + " print \"\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def check_cpuidle_states(te, platform):\n", + " print \"cpuidle States\"\n", + " print \"===========\"\n", + " states = int(te.target.execute('cat /sys/devices/system/cpu/cpu0/cpuidle/state*/name | wc -l'))\n", + " if states == idle_states[platform]:\n", + " print G + \"OK\" + W\n", + " else:\n", + " print R + \"FAILURE\" + W\n", + " print \"Wrong number of idle states\"\n", + " print \"Expected: {}\".format(idle_states[platform])\n", + " print \"Read from target: {}\".format(states)\n", + " print \"\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def check_utilest(te, platform):\n", + " print \"UtilEst\"\n", + " print \"===========\"\n", + " sched_features = te.target.execute('cat /sys/kernel/debug/sched_features | grep UTIL_EST', as_root=True)\n", + " if not sched_features:\n", + " print R + \"FAILURE\" + W\n", + " print \"Sched feature UtilEst not available\"\n", + " else:\n", + " print G + \"OK\" + W\n", + " print \"\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def test_eas_integration(te, platform):\n", + " \"\"\"\n", + " Print test results for EAS integration branch.\n", + " \n", + " :param platform: test platform name. Valid values:\n", + " - hikey\n", + " - juno\n", + " - tc2\n", + " - hikey960\n", + " :type platform: str\n", + " \n", + " :param te: test environment object\n", + " :type te: env.TestEnv\n", + " \"\"\"\n", + " platform = platform.lower()\n", + " available_platforms = ['hikey', 'juno', 'tc2', 'hikey960']\n", + " if platform not in available_platforms:\n", + " raise ValueError('Invalid platform value {}, accepted values are: {}'\n", + " .format(available_platforms))\n", + "\n", + " print \"Kernel Version\"\n", + " print \"==============\"\n", + " print te.target.kernel_version\n", + " print \"\"\n", + "\n", + " check_config(te, platform)\n", + " check_sched_domains(te, platform)\n", + " check_cpu_parts(te, platform)\n", + " check_energy_model(te, platform)\n", + " check_sched_domain_flags(te, platform)\n", + " check_cpufreq_policies(te, platform)\n", + " check_cpuidle_states(te, platform)\n", + " check_utilest(te, platform)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Juno" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "run_control": { + "marked": false + } + }, + "outputs": [], + "source": [ + "# Where results will be collected\n", + "RESULTS_BASE = 'eas_integration/juno'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "run_control": { + "marked": false + } + }, + "outputs": [], + "source": [ + "# Setup target configuration\n", + "my_conf = {\n", + "\n", + " # Target platform and board\n", + " \"platform\" : 'linux',\n", + " \"board\" : 'juno-r2',\n", + "\n", + " \"host\": \"10.1.210.22\",\n", + " \n", + " \"modules\" : ['cpufreq', 'cgroups'],\n", + " \n", + " \"results_dir\" : RESULTS_BASE,\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "te = TestEnv(my_conf, force_new=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "test_eas_integration(te, 'juno')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Hikey620" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "run_control": { + "marked": false + } + }, + "outputs": [], + "source": [ + "# Where results will be collected\n", + "RESULTS_BASE = 'eas_integration/hikey620'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "run_control": { + "marked": false + } + }, + "outputs": [], + "source": [ + "# Setup target configuration\n", + "my_conf = {\n", + "\n", + " # Target platform and board\n", + " \"platform\" : 'linux',\n", + " \"board\" : 'hikey',\n", + "\n", + " \"host\": \"10.1.210.62\",\n", + " \n", + " \"modules\" : ['cpufreq', 'cgroups'],\n", + " \n", + " \"results_dir\" : RESULTS_BASE,\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "te = TestEnv(my_conf, force_new=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "test_eas_integration(te, 'hikey')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# TC2" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "run_control": { + "marked": false + } + }, + "outputs": [], + "source": [ + "# Where results will be collected\n", + "RESULTS_BASE = 'eas_integration/tc2'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "run_control": { + "marked": false + } + }, + "outputs": [], + "source": [ + "# Setup target configuration\n", + "my_conf = {\n", + "\n", + " # Target platform and board\n", + " \"platform\" : 'linux',\n", + " \"board\" : 'tc2',\n", + "\n", + " \"host\": \"10.1.210.72\",\n", + " \n", + " \"modules\" : ['cpufreq', 'cgroups', 'cpuidle'],\n", + " \n", + " \"results_dir\" : RESULTS_BASE,\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "te = TestEnv(my_conf, force_new=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "test_eas_integration(te, 'tc2')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Hikey960" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "run_control": { + "marked": false + } + }, + "outputs": [], + "source": [ + "# Where results will be collected\n", + "RESULTS_BASE = 'eas_integration/hikey960'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "run_control": { + "marked": false + } + }, + "outputs": [], + "source": [ + "# Setup target configuration\n", + "my_conf = {\n", + "\n", + " # Target platform and board\n", + " \"platform\" : 'linux',\n", + " \"board\" : 'hikey960',\n", + " \"username\" : 'linaro',\n", + " \"password\" : 'linaro',\n", + "\n", + " \"host\": \"10.1.210.44\",\n", + " \n", + " \"modules\" : ['cpufreq', 'cgroups'],\n", + " \n", + " \"results_dir\" : RESULTS_BASE,\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "te = TestEnv(my_conf, force_new=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "test_eas_integration(te, 'hikey960')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Patch Statistics" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "\n", + "from datetime import datetime\n", + "\n", + "stats_filename = 'stats_{}.txt'.format(datetime.now().strftime('%Y%m%d'))\n", + "\n", + "KERNEL_GIT_DIR = '/data/IntegrationBase/kernel/.git/'\n", + "MANIFEST_DIR = '/data/IntegrationBase/kernel.manifest/'\n", + "MANIFEST_FILE = os.path.join(MANIFEST_DIR, 'manifest')\n", + "STATS_FILE = os.path.join(MANIFEST_DIR, 'patch_stats', stats_filename)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import re\n", + "import subprocess\n", + "\n", + "re_topic = re.compile(\"topic\\s+(\\S+)\\s+(\\S+)\\s+TIP\\s+\\-\\s+rebase\\s+(\\S+)\")\n", + "\n", + "\n", + "f = open(MANIFEST_FILE, 'r')\n", + "fout = open(STATS_FILE, 'w')\n", + "\n", + "total_commits = 0\n", + "\n", + "\n", + "fout.write(\"### Integration patch statistics\\n\")\n", + "fout.write(\"### manifest: {}\\n\\n\".format(MANIFEST_FILE))\n", + "fout.write(\"{:30} {:8} {:2} {:40}\\n\".format(\"### topic\",\"owner\",\"#\",\"branch\"))\n", + "\n", + "for line in f:\n", + " topic_def = re_topic.match(line)\n", + " if not (topic_def):\n", + " continue\n", + "\n", + " topic = topic_def.group(1)\n", + " base = topic_def.group(3)\n", + " tip = topic_def.group(2)\n", + "\n", + " owner = tip.split('/')[0]\n", + "\n", + " commits = subprocess.check_output([\"git\",\n", + " \"--git-dir\", KERNEL_GIT_DIR,\n", + " \"log\",\n", + " \"--oneline\",\n", + " base+\"..\"+tip])\n", + " patch_count = len(commits.splitlines())\n", + " total_commits += patch_count\n", + " fout.write(\"{:30} {:8} {:2} {:40}\\n\".format(topic,owner,patch_count,tip))\n", + "\n", + "fout.write(\"{:30} {:8} {:2} {:40}\\n\".format(\"### Total\",\"\",total_commits,\"\"))\n", + "\n", + "f.close()\n", + "fout.close()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "!cat $STATS_FILE" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.12" + }, + "toc": { + "colors": { + "hover_highlight": "#DAA520", + "running_highlight": "#FF0000", + "selected_highlight": "#FFD700" + }, + "moveMenuLeft": true, + "nav_menu": { + "height": "171px", + "width": "253px" + }, + "navigate_menu": true, + "number_sections": true, + "sideBar": true, + "threshold": 4, + "toc_cell": false, + "toc_number_sections": true, + "toc_section_display": "block", + "toc_threshold": 6, + "toc_window_display": true + }, + "toc_position": { + "height": "271px", + "left": "1621px", + "right": "36px", + "top": "121px", + "width": "263px" + } + }, + "nbformat": 4, + "nbformat_minor": 1 +}