1f08c3bdfSopenharmony_ci 2f08c3bdfSopenharmony_ciTEST SUITE: 3f08c3bdfSopenharmony_ci 4f08c3bdfSopenharmony_ciThe directory cpuctl contains the tests related to the cpu controller. 5f08c3bdfSopenharmony_ciThere are total 10 testcases that have been added till date. 6f08c3bdfSopenharmony_ciMore testcases are expected to be added in future. 7f08c3bdfSopenharmony_ci 8f08c3bdfSopenharmony_ciTESTS AIM: 9f08c3bdfSopenharmony_ci 10f08c3bdfSopenharmony_ciThe aim of the tests is to test cpu controller functionality. 11f08c3bdfSopenharmony_ci 12f08c3bdfSopenharmony_ciFILES DESCRIPTION: 13f08c3bdfSopenharmony_ci 14f08c3bdfSopenharmony_cicpuctl_testN.c 15f08c3bdfSopenharmony_ci--------------- 16f08c3bdfSopenharmony_ciThese are the tasks to run for cpu controller testing. 17f08c3bdfSopenharmony_ciThe tasks have been automated in the sense that they can assign themselves to 18f08c3bdfSopenharmony_cithe appropriate group, can modify their group shares, can migrate etc. 19f08c3bdfSopenharmony_ciEach task runs for an interval TIME_INTERVAL seconds and reports the total time 20f08c3bdfSopenharmony_ciit could run on all cpus in an interval of INTERVAL seconds. (for convinience 21f08c3bdfSopenharmony_cicalculate cpu time is given in % and seconds both). 22f08c3bdfSopenharmony_ciA task can call a library routine from libcontrollers library to calculate 23f08c3bdfSopenharmony_citotal amount of shares of all the groups, total number of tasks in it's group etc. 24f08c3bdfSopenharmony_ciAnd thus a task knows what is the expected cpu time it should get to run. 25f08c3bdfSopenharmony_ci 26f08c3bdfSopenharmony_ciAfter say n SETS it modifies it's parameters and again report the cpu 27f08c3bdfSopenharmony_ciusage. 28f08c3bdfSopenharmony_ciMaximum effort has been used to reuse the code and keep total code size low. 29f08c3bdfSopenharmony_ci 30f08c3bdfSopenharmony_ciparameters.sh 31f08c3bdfSopenharmony_ci---------- 32f08c3bdfSopenharmony_ciThis file contains the functions which do setup for the test. It creates a 33f08c3bdfSopenharmony_ci/dev/cpuctl directory, mounts cgroup filesystem on it with cpu. It then creates 34f08c3bdfSopenharmony_cia number(n) of groups in /dev/cpuctl. The cleanup function does a complete cleanup 35f08c3bdfSopenharmony_ciof the system. 36f08c3bdfSopenharmony_ci(*However most of the error scenarios have been tested for a sane cleanup, still if 37f08c3bdfSopenharmony_cisometime it is unable to do it justt manualy execute the commands written in cleanup 38f08c3bdfSopenharmony_cifunction) 39f08c3bdfSopenharmony_ci 40f08c3bdfSopenharmony_cirun_cpuctl_test.sh 41f08c3bdfSopenharmony_ci------------------ 42f08c3bdfSopenharmony_ciThis script creates different scenarios for cpu controller testing and fires (n) tasks 43f08c3bdfSopenharmony_ciin different groups to run at the same time. It waits for the return status from 44f08c3bdfSopenharmony_citasks and reports test pass/fail accordingly. 45f08c3bdfSopenharmony_ci 46f08c3bdfSopenharmony_ciMakefile 47f08c3bdfSopenharmony_ci-------- 48f08c3bdfSopenharmony_ci 49f08c3bdfSopenharmony_ciThe usual makefile for this directory 50f08c3bdfSopenharmony_ci 51f08c3bdfSopenharmony_ci$LTPROOT/output/cpuctl_resultsN.txt 52f08c3bdfSopenharmony_ci-------------- 53f08c3bdfSopenharmony_ciThis file will be created to log the results once the test is run. It contains the test 54f08c3bdfSopenharmony_ciresults which are numbers and following is a description which will help to understand 55f08c3bdfSopenharmony_cithe results. 56f08c3bdfSopenharmony_ci 57f08c3bdfSopenharmony_ciThere are two common major expected outcomes of all the tests: 58f08c3bdfSopenharmony_ci 59f08c3bdfSopenharmony_ci1. A group should get cpu time in the same ratio as it's shares. 60f08c3bdfSopenharmony_ci 61f08c3bdfSopenharmony_ci2. This time should not change with the changes in share values while the ratio in those 62f08c3bdfSopenharmony_ci values is same. 63f08c3bdfSopenharmony_ci 64f08c3bdfSopenharmony_ciThe results file are straight forward to read. To keep things very simple just look at 65f08c3bdfSopenharmony_cithe two fields calc:- and exp:- in % as below: 66f08c3bdfSopenharmony_ci 67f08c3bdfSopenharmony_ciCPU TIME{calc:- 60.01(s)i.e. 50.01(%) exp:- 50.00(%)} 68f08c3bdfSopenharmony_ci 69f08c3bdfSopenharmony_ciPASS/FAIL CRITERIO: 70f08c3bdfSopenharmony_ci================== 71f08c3bdfSopenharmony_ciA major difference in the two % values is a failure of cpu controller. 72f08c3bdfSopenharmony_ciAlso the difference between consecutive runs under similar conditions is fail. 73f08c3bdfSopenharmony_ciBecause of some feature which is not currently developed in kernel it is not 74f08c3bdfSopenharmony_cipossible to create an ideal scenario and hence the decision of PASS/FAIL is 75f08c3bdfSopenharmony_cinot taken for all the tests at the moment. The statistics is generated in the 76f08c3bdfSopenharmony_ciresults file and a quick look on it gives a proper understanding. 77f08c3bdfSopenharmony_ci 78f08c3bdfSopenharmony_ciNOTE: In current scenario a variation of 1-3 % is acceptable. 79f08c3bdfSopenharmony_ci 80f08c3bdfSopenharmony_ciREADME: 81f08c3bdfSopenharmony_ci-------- 82f08c3bdfSopenharmony_ciThe one you have gone through. 83f08c3bdfSopenharmony_ci 84