selftests/resctrl: Call kselftest APIs to log test results

Call kselftest APIs instead of using printf() to log test results
for cleaner code and better future extension.

Suggested-by: Shuah Khan <skhan@linuxfoundation.org>
Tested-by: Babu Moger <babu.moger@amd.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
Fenghua Yu 2021-03-17 02:22:42 +00:00 committed by Shuah Khan
parent 2f320911d9
commit ca2f4214f9
8 changed files with 105 additions and 117 deletions

View File

@ -52,25 +52,28 @@ static int cat_setup(int num, ...)
return ret; return ret;
} }
static void show_cache_info(unsigned long sum_llc_perf_miss, int no_of_bits, static int show_cache_info(unsigned long sum_llc_perf_miss, int no_of_bits,
unsigned long span) unsigned long span)
{ {
unsigned long allocated_cache_lines = span / 64; unsigned long allocated_cache_lines = span / 64;
unsigned long avg_llc_perf_miss = 0; unsigned long avg_llc_perf_miss = 0;
float diff_percent; float diff_percent;
int ret;
avg_llc_perf_miss = sum_llc_perf_miss / (NUM_OF_RUNS - 1); avg_llc_perf_miss = sum_llc_perf_miss / (NUM_OF_RUNS - 1);
diff_percent = ((float)allocated_cache_lines - avg_llc_perf_miss) / diff_percent = ((float)allocated_cache_lines - avg_llc_perf_miss) /
allocated_cache_lines * 100; allocated_cache_lines * 100;
printf("%sok CAT: cache miss rate within %d%%\n", ret = !is_amd && abs((int)diff_percent) > MAX_DIFF_PERCENT;
!is_amd && abs((int)diff_percent) > MAX_DIFF_PERCENT ? ksft_print_msg("Cache miss rate %swithin %d%%\n",
"not " : "", MAX_DIFF_PERCENT); ret ? "not " : "", MAX_DIFF_PERCENT);
tests_run++;
printf("# Percent diff=%d\n", abs((int)diff_percent)); ksft_print_msg("Percent diff=%d\n", abs((int)diff_percent));
printf("# Number of bits: %d\n", no_of_bits); ksft_print_msg("Number of bits: %d\n", no_of_bits);
printf("# Avg_llc_perf_miss: %lu\n", avg_llc_perf_miss); ksft_print_msg("Avg_llc_perf_miss: %lu\n", avg_llc_perf_miss);
printf("# Allocated cache lines: %lu\n", allocated_cache_lines); ksft_print_msg("Allocated cache lines: %lu\n", allocated_cache_lines);
return ret;
} }
static int check_results(struct resctrl_val_param *param) static int check_results(struct resctrl_val_param *param)
@ -80,7 +83,7 @@ static int check_results(struct resctrl_val_param *param)
int runs = 0, no_of_bits = 0; int runs = 0, no_of_bits = 0;
FILE *fp; FILE *fp;
printf("# Checking for pass/fail\n"); ksft_print_msg("Checking for pass/fail\n");
fp = fopen(param->filename, "r"); fp = fopen(param->filename, "r");
if (!fp) { if (!fp) {
perror("# Cannot open file"); perror("# Cannot open file");
@ -108,9 +111,7 @@ static int check_results(struct resctrl_val_param *param)
fclose(fp); fclose(fp);
no_of_bits = count_bits(param->mask); no_of_bits = count_bits(param->mask);
show_cache_info(sum_llc_perf_miss, no_of_bits, param->span); return show_cache_info(sum_llc_perf_miss, no_of_bits, param->span);
return 0;
} }
void cat_test_cleanup(void) void cat_test_cleanup(void)
@ -146,15 +147,15 @@ int cat_perf_miss_val(int cpu_no, int n, char *cache_type)
ret = get_cache_size(cpu_no, cache_type, &cache_size); ret = get_cache_size(cpu_no, cache_type, &cache_size);
if (ret) if (ret)
return ret; return ret;
printf("cache size :%lu\n", cache_size); ksft_print_msg("Cache size :%lu\n", cache_size);
/* Get max number of bits from default-cabm mask */ /* Get max number of bits from default-cabm mask */
count_of_bits = count_bits(long_mask); count_of_bits = count_bits(long_mask);
if (n < 1 || n > count_of_bits - 1) { if (n < 1 || n > count_of_bits - 1) {
printf("Invalid input value for no_of_bits n!\n"); ksft_print_msg("Invalid input value for no_of_bits n!\n");
printf("Please Enter value in range 1 to %d\n", ksft_print_msg("Please enter value in range 1 to %d\n",
count_of_bits - 1); count_of_bits - 1);
return -1; return -1;
} }

View File

@ -39,36 +39,33 @@ static int cmt_setup(int num, ...)
return 0; return 0;
} }
static void show_cache_info(unsigned long sum_llc_occu_resc, int no_of_bits, static int show_cache_info(unsigned long sum_llc_occu_resc, int no_of_bits,
unsigned long span) unsigned long span)
{ {
unsigned long avg_llc_occu_resc = 0; unsigned long avg_llc_occu_resc = 0;
float diff_percent; float diff_percent;
long avg_diff = 0; long avg_diff = 0;
bool res; int ret;
avg_llc_occu_resc = sum_llc_occu_resc / (NUM_OF_RUNS - 1); avg_llc_occu_resc = sum_llc_occu_resc / (NUM_OF_RUNS - 1);
avg_diff = (long)abs(span - avg_llc_occu_resc); avg_diff = (long)abs(span - avg_llc_occu_resc);
diff_percent = (((float)span - avg_llc_occu_resc) / span) * 100; diff_percent = (((float)span - avg_llc_occu_resc) / span) * 100;
if ((abs((int)diff_percent) <= MAX_DIFF_PERCENT) || ret = (abs((int)diff_percent) > MAX_DIFF_PERCENT) &&
(abs(avg_diff) <= MAX_DIFF)) (abs(avg_diff) > MAX_DIFF);
res = true;
else
res = false;
printf("%sok CMT: diff within %d, %d\%%\n", res ? "" : "not", ksft_print_msg("%s cache miss diff within %d, %d\%%\n",
MAX_DIFF, (int)MAX_DIFF_PERCENT); ret ? "Fail:" : "Pass:", MAX_DIFF, (int)MAX_DIFF_PERCENT);
printf("# diff: %ld\n", avg_diff); ksft_print_msg("Diff: %ld\n", avg_diff);
printf("# percent diff=%d\n", abs((int)diff_percent)); ksft_print_msg("Percent diff=%d\n", abs((int)diff_percent));
printf("# Results are displayed in (Bytes)\n"); ksft_print_msg("Results are displayed in (Bytes)\n");
printf("# Number of bits: %d\n", no_of_bits); ksft_print_msg("Number of bits: %d\n", no_of_bits);
printf("# Avg_llc_occu_resc: %lu\n", avg_llc_occu_resc); ksft_print_msg("Avg_llc_occu_resc: %lu\n", avg_llc_occu_resc);
printf("# llc_occu_exp (span): %lu\n", span); ksft_print_msg("llc_occu_exp (span): %lu\n", span);
tests_run++; return ret;
} }
static int check_results(struct resctrl_val_param *param, int no_of_bits) static int check_results(struct resctrl_val_param *param, int no_of_bits)
@ -78,7 +75,7 @@ static int check_results(struct resctrl_val_param *param, int no_of_bits)
int runs = 0; int runs = 0;
FILE *fp; FILE *fp;
printf("# checking for pass/fail\n"); ksft_print_msg("Checking for pass/fail\n");
fp = fopen(param->filename, "r"); fp = fopen(param->filename, "r");
if (!fp) { if (!fp) {
perror("# Error in opening file\n"); perror("# Error in opening file\n");
@ -101,9 +98,8 @@ static int check_results(struct resctrl_val_param *param, int no_of_bits)
runs++; runs++;
} }
fclose(fp); fclose(fp);
show_cache_info(sum_llc_occu_resc, no_of_bits, param->span);
return 0; return show_cache_info(sum_llc_occu_resc, no_of_bits, param->span);
} }
void cmt_test_cleanup(void) void cmt_test_cleanup(void)
@ -134,13 +130,13 @@ int cmt_resctrl_val(int cpu_no, int n, char **benchmark_cmd)
ret = get_cache_size(cpu_no, "L3", &cache_size); ret = get_cache_size(cpu_no, "L3", &cache_size);
if (ret) if (ret)
return ret; return ret;
printf("cache size :%lu\n", cache_size); ksft_print_msg("Cache size :%lu\n", cache_size);
count_of_bits = count_bits(long_mask); count_of_bits = count_bits(long_mask);
if (n < 1 || n > count_of_bits) { if (n < 1 || n > count_of_bits) {
printf("Invalid input value for numbr_of_bits n!\n"); ksft_print_msg("Invalid input value for numbr_of_bits n!\n");
printf("Please Enter value in range 1 to %d\n", count_of_bits); ksft_print_msg("Please enter value in range 1 to %d\n", count_of_bits);
return -1; return -1;
} }

View File

@ -56,7 +56,7 @@ static void show_mba_info(unsigned long *bw_imc, unsigned long *bw_resc)
int allocation, runs; int allocation, runs;
bool failed = false; bool failed = false;
printf("# Results are displayed in (MB)\n"); ksft_print_msg("Results are displayed in (MB)\n");
/* Memory bandwidth from 100% down to 10% */ /* Memory bandwidth from 100% down to 10% */
for (allocation = 0; allocation < ALLOCATION_MAX / ALLOCATION_STEP; for (allocation = 0; allocation < ALLOCATION_MAX / ALLOCATION_STEP;
allocation++) { allocation++) {
@ -78,21 +78,21 @@ static void show_mba_info(unsigned long *bw_imc, unsigned long *bw_resc)
avg_bw_resc = sum_bw_resc / (NUM_OF_RUNS - 1); avg_bw_resc = sum_bw_resc / (NUM_OF_RUNS - 1);
avg_diff = labs((long)(avg_bw_resc - avg_bw_imc)); avg_diff = labs((long)(avg_bw_resc - avg_bw_imc));
printf("%sok MBA schemata percentage %u smaller than %d %%\n", ksft_print_msg("%s MBA schemata percentage %u smaller than %d %%\n",
avg_diff > MAX_DIFF ? "not " : "", avg_diff > MAX_DIFF ? "Fail:" : "Pass:",
ALLOCATION_MAX - ALLOCATION_STEP * allocation, ALLOCATION_MAX - ALLOCATION_STEP * allocation,
MAX_DIFF); MAX_DIFF);
tests_run++; ksft_print_msg("avg_diff: %lu\n", avg_diff);
printf("# avg_diff: %lu\n", avg_diff); ksft_print_msg("avg_bw_imc: %lu\n", avg_bw_imc);
printf("# avg_bw_imc: %lu\n", avg_bw_imc); ksft_print_msg("avg_bw_resc: %lu\n", avg_bw_resc);
printf("# avg_bw_resc: %lu\n", avg_bw_resc);
if (avg_diff > MAX_DIFF) if (avg_diff > MAX_DIFF)
failed = true; failed = true;
} }
printf("%sok schemata change using MBA%s\n", failed ? "not " : "", ksft_print_msg("%s schemata change using MBA\n",
failed ? " # at least one test failed" : ""); failed ? "Fail:" : "Pass:");
tests_run++; if (failed)
ksft_print_msg("At least one test failed");
} }
static int check_results(void) static int check_results(void)

View File

@ -14,13 +14,13 @@
#define MAX_DIFF 300 #define MAX_DIFF 300
#define NUM_OF_RUNS 5 #define NUM_OF_RUNS 5
static void static int
show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, int span) show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, int span)
{ {
unsigned long avg_bw_imc = 0, avg_bw_resc = 0; unsigned long avg_bw_imc = 0, avg_bw_resc = 0;
unsigned long sum_bw_imc = 0, sum_bw_resc = 0; unsigned long sum_bw_imc = 0, sum_bw_resc = 0;
long avg_diff = 0; long avg_diff = 0;
int runs; int runs, ret;
/* /*
* Discard the first value which is inaccurate due to monitoring setup * Discard the first value which is inaccurate due to monitoring setup
@ -35,13 +35,15 @@ show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, int span)
avg_bw_resc = sum_bw_resc / 4; avg_bw_resc = sum_bw_resc / 4;
avg_diff = avg_bw_resc - avg_bw_imc; avg_diff = avg_bw_resc - avg_bw_imc;
printf("%sok MBM: diff within %d%%\n", ret = labs(avg_diff) > MAX_DIFF;
labs(avg_diff) > MAX_DIFF ? "not " : "", MAX_DIFF); ksft_print_msg("%s MBM: diff within %d%%\n",
tests_run++; ret ? "Fail:" : "Pass:", MAX_DIFF);
printf("# avg_diff: %lu\n", labs(avg_diff)); ksft_print_msg("avg_diff: %lu\n", labs(avg_diff));
printf("# Span (MB): %d\n", span); ksft_print_msg("Span (MB): %d\n", span);
printf("# avg_bw_imc: %lu\n", avg_bw_imc); ksft_print_msg("avg_bw_imc: %lu\n", avg_bw_imc);
printf("# avg_bw_resc: %lu\n", avg_bw_resc); ksft_print_msg("avg_bw_resc: %lu\n", avg_bw_resc);
return ret;
} }
static int check_results(int span) static int check_results(int span)
@ -49,10 +51,10 @@ static int check_results(int span)
unsigned long bw_imc[NUM_OF_RUNS], bw_resc[NUM_OF_RUNS]; unsigned long bw_imc[NUM_OF_RUNS], bw_resc[NUM_OF_RUNS];
char temp[1024], *token_array[8]; char temp[1024], *token_array[8];
char output[] = RESULT_FILE_NAME; char output[] = RESULT_FILE_NAME;
int runs; int runs, ret;
FILE *fp; FILE *fp;
printf("# Checking for pass/fail\n"); ksft_print_msg("Checking for pass/fail\n");
fp = fopen(output, "r"); fp = fopen(output, "r");
if (!fp) { if (!fp) {
@ -76,11 +78,11 @@ static int check_results(int span)
runs++; runs++;
} }
show_bw_info(bw_imc, bw_resc, span); ret = show_bw_info(bw_imc, bw_resc, span);
fclose(fp); fclose(fp);
return 0; return ret;
} }
static int mbm_setup(int num, ...) static int mbm_setup(int num, ...)

View File

@ -23,6 +23,7 @@
#include <sys/eventfd.h> #include <sys/eventfd.h>
#include <asm/unistd.h> #include <asm/unistd.h>
#include <linux/perf_event.h> #include <linux/perf_event.h>
#include "../kselftest.h"
#define MB (1024 * 1024) #define MB (1024 * 1024)
#define RESCTRL_PATH "/sys/fs/resctrl" #define RESCTRL_PATH "/sys/fs/resctrl"
@ -68,7 +69,6 @@ struct resctrl_val_param {
#define CAT_STR "cat" #define CAT_STR "cat"
extern pid_t bm_pid, ppid; extern pid_t bm_pid, ppid;
extern int tests_run;
extern char llc_occup_path[1024]; extern char llc_occup_path[1024];
extern bool is_amd; extern bool is_amd;

View File

@ -60,7 +60,7 @@ int main(int argc, char **argv)
int res, c, cpu_no = 1, span = 250, argc_new = argc, i, no_of_bits = 5; int res, c, cpu_no = 1, span = 250, argc_new = argc, i, no_of_bits = 5;
char *benchmark_cmd[BENCHMARK_ARGS], bw_report[64], bm_type[64]; char *benchmark_cmd[BENCHMARK_ARGS], bw_report[64], bm_type[64];
char benchmark_cmd_area[BENCHMARK_ARGS][BENCHMARK_ARG_SIZE]; char benchmark_cmd_area[BENCHMARK_ARGS][BENCHMARK_ARG_SIZE];
int ben_ind, ben_count; int ben_ind, ben_count, tests = 0;
bool cat_test = true; bool cat_test = true;
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
@ -87,12 +87,16 @@ int main(int argc, char **argv)
while (token) { while (token) {
if (!strncmp(token, MBM_STR, sizeof(MBM_STR))) { if (!strncmp(token, MBM_STR, sizeof(MBM_STR))) {
mbm_test = true; mbm_test = true;
tests++;
} else if (!strncmp(token, MBA_STR, sizeof(MBA_STR))) { } else if (!strncmp(token, MBA_STR, sizeof(MBA_STR))) {
mba_test = true; mba_test = true;
tests++;
} else if (!strncmp(token, CMT_STR, sizeof(CMT_STR))) { } else if (!strncmp(token, CMT_STR, sizeof(CMT_STR))) {
cmt_test = true; cmt_test = true;
tests++;
} else if (!strncmp(token, CAT_STR, sizeof(CAT_STR))) { } else if (!strncmp(token, CAT_STR, sizeof(CAT_STR))) {
cat_test = true; cat_test = true;
tests++;
} else { } else {
printf("invalid argument\n"); printf("invalid argument\n");
@ -118,7 +122,7 @@ int main(int argc, char **argv)
} }
} }
printf("TAP version 13\n"); ksft_print_header();
/* /*
* Typically we need root privileges, because: * Typically we need root privileges, because:
@ -126,7 +130,7 @@ int main(int argc, char **argv)
* 2. We execute perf commands * 2. We execute perf commands
*/ */
if (geteuid() != 0) if (geteuid() != 0)
printf("# WARNING: not running as root, tests may fail.\n"); return ksft_exit_fail_msg("Not running as root, abort testing.\n");
/* Detect AMD vendor */ /* Detect AMD vendor */
detect_amd(); detect_amd();
@ -155,48 +159,46 @@ int main(int argc, char **argv)
sprintf(bw_report, "reads"); sprintf(bw_report, "reads");
sprintf(bm_type, "fill_buf"); sprintf(bm_type, "fill_buf");
check_resctrlfs_support(); if (!check_resctrlfs_support())
return ksft_exit_fail_msg("resctrl FS does not exist\n");
filter_dmesg(); filter_dmesg();
ksft_set_plan(tests ? : 4);
if (!is_amd && mbm_test) { if (!is_amd && mbm_test) {
printf("# Starting MBM BW change ...\n"); ksft_print_msg("Starting MBM BW change ...\n");
if (!has_ben) if (!has_ben)
sprintf(benchmark_cmd[5], "%s", MBA_STR); sprintf(benchmark_cmd[5], "%s", MBA_STR);
res = mbm_bw_change(span, cpu_no, bw_report, benchmark_cmd); res = mbm_bw_change(span, cpu_no, bw_report, benchmark_cmd);
printf("%sok MBM: bw change\n", res ? "not " : ""); ksft_test_result(!res, "MBM: bw change\n");
mbm_test_cleanup(); mbm_test_cleanup();
tests_run++;
} }
if (!is_amd && mba_test) { if (!is_amd && mba_test) {
printf("# Starting MBA Schemata change ...\n"); ksft_print_msg("Starting MBA Schemata change ...\n");
if (!has_ben) if (!has_ben)
sprintf(benchmark_cmd[1], "%d", span); sprintf(benchmark_cmd[1], "%d", span);
res = mba_schemata_change(cpu_no, bw_report, benchmark_cmd); res = mba_schemata_change(cpu_no, bw_report, benchmark_cmd);
printf("%sok MBA: schemata change\n", res ? "not " : ""); ksft_test_result(!res, "MBA: schemata change\n");
mba_test_cleanup(); mba_test_cleanup();
tests_run++;
} }
if (cmt_test) { if (cmt_test) {
printf("# Starting CMT test ...\n"); ksft_print_msg("Starting CMT test ...\n");
if (!has_ben) if (!has_ben)
sprintf(benchmark_cmd[5], "%s", CMT_STR); sprintf(benchmark_cmd[5], "%s", CMT_STR);
res = cmt_resctrl_val(cpu_no, no_of_bits, benchmark_cmd); res = cmt_resctrl_val(cpu_no, no_of_bits, benchmark_cmd);
printf("%sok CMT: test\n", res ? "not " : ""); ksft_test_result(!res, "CMT: test\n");
cmt_test_cleanup(); cmt_test_cleanup();
tests_run++;
} }
if (cat_test) { if (cat_test) {
printf("# Starting CAT test ...\n"); ksft_print_msg("Starting CAT test ...\n");
res = cat_perf_miss_val(cpu_no, no_of_bits, "L3"); res = cat_perf_miss_val(cpu_no, no_of_bits, "L3");
printf("%sok CAT: test\n", res ? "not " : ""); ksft_test_result(!res, "CAT: test\n");
tests_run++;
cat_test_cleanup(); cat_test_cleanup();
} }
printf("1..%d\n", tests_run); return ksft_exit_pass();
return 0;
} }

View File

@ -449,7 +449,7 @@ void ctrlc_handler(int signum, siginfo_t *info, void *ptr)
kill(bm_pid, SIGKILL); kill(bm_pid, SIGKILL);
umount_resctrlfs(); umount_resctrlfs();
tests_cleanup(); tests_cleanup();
printf("Ending\n\n"); ksft_print_msg("Ending\n\n");
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
@ -645,7 +645,7 @@ int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param)
PARENT_EXIT("Child is done"); PARENT_EXIT("Child is done");
} }
printf("# benchmark PID: %d\n", bm_pid); ksft_print_msg("Benchmark PID: %d\n", bm_pid);
/* /*
* Register CTRL-C handler for parent, as it has to kill benchmark * Register CTRL-C handler for parent, as it has to kill benchmark

View File

@ -10,8 +10,6 @@
*/ */
#include "resctrl.h" #include "resctrl.h"
int tests_run;
static int find_resctrl_mount(char *buffer) static int find_resctrl_mount(char *buffer)
{ {
FILE *mounts; FILE *mounts;
@ -68,23 +66,17 @@ int remount_resctrlfs(bool mum_resctrlfs)
if (ret) if (ret)
strcpy(mountpoint, RESCTRL_PATH); strcpy(mountpoint, RESCTRL_PATH);
if (!ret && mum_resctrlfs && umount(mountpoint)) { if (!ret && mum_resctrlfs && umount(mountpoint))
printf("not ok unmounting \"%s\"\n", mountpoint); ksft_print_msg("Fail: unmounting \"%s\"\n", mountpoint);
perror("# umount");
tests_run++;
}
if (!ret && !mum_resctrlfs) if (!ret && !mum_resctrlfs)
return 0; return 0;
ksft_print_msg("Mounting resctrl to \"%s\"\n", RESCTRL_PATH);
ret = mount("resctrl", RESCTRL_PATH, "resctrl", 0, NULL); ret = mount("resctrl", RESCTRL_PATH, "resctrl", 0, NULL);
printf("%sok mounting resctrl to \"%s\"\n", ret ? "not " : "",
RESCTRL_PATH);
if (ret) if (ret)
perror("# mount"); perror("# mount");
tests_run++;
return ret; return ret;
} }
@ -477,13 +469,10 @@ int write_bm_pid_to_resctrl(pid_t bm_pid, char *ctrlgrp, char *mongrp,
} }
out: out:
printf("%sok writing benchmark parameters to resctrl FS\n", ksft_print_msg("Writing benchmark parameters to resctrl FS\n");
ret ? "not " : "");
if (ret) if (ret)
perror("# writing to resctrlfs"); perror("# writing to resctrlfs");
tests_run++;
return ret; return ret;
} }
@ -511,7 +500,7 @@ int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, char *resctrl_val)
return -ENOENT; return -ENOENT;
if (!schemata) { if (!schemata) {
printf("# Skipping empty schemata update\n"); ksft_print_msg("Skipping empty schemata update\n");
return -1; return -1;
} }
@ -552,10 +541,9 @@ int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, char *resctrl_val)
fclose(fp); fclose(fp);
out: out:
printf("%sok Write schema \"%s\" to resctrl FS%s%s\n", ksft_print_msg("Write schema \"%s\" to resctrl FS%s%s\n",
ret ? "not " : "", schema, ret ? " # " : "", schema, ret ? " # " : "",
ret ? reason : ""); ret ? reason : "");
tests_run++;
return ret; return ret;
} }
@ -579,18 +567,17 @@ bool check_resctrlfs_support(void)
fclose(inf); fclose(inf);
printf("%sok kernel supports resctrl filesystem\n", ret ? "" : "not "); ksft_print_msg("%s kernel supports resctrl filesystem\n",
tests_run++; ret ? "Pass:" : "Fail:");
dp = opendir(RESCTRL_PATH); dp = opendir(RESCTRL_PATH);
printf("%sok resctrl mountpoint \"%s\" exists\n", ksft_print_msg("%s resctrl mountpoint \"%s\" exists\n",
dp ? "" : "not ", RESCTRL_PATH); dp ? "Pass:" : "Fail:", RESCTRL_PATH);
if (dp) if (dp)
closedir(dp); closedir(dp);
tests_run++;
printf("# resctrl filesystem %s mounted\n", ksft_print_msg("resctrl filesystem %s mounted\n",
find_resctrl_mount(NULL) ? "not" : "is"); find_resctrl_mount(NULL) ? "not" : "is");
return ret; return ret;
} }
@ -672,9 +659,9 @@ int filter_dmesg(void)
while (fgets(line, 1024, fp)) { while (fgets(line, 1024, fp)) {
if (strstr(line, "intel_rdt:")) if (strstr(line, "intel_rdt:"))
printf("# dmesg: %s", line); ksft_print_msg("dmesg: %s", line);
if (strstr(line, "resctrl:")) if (strstr(line, "resctrl:"))
printf("# dmesg: %s", line); ksft_print_msg("dmesg: %s", line);
} }
fclose(fp); fclose(fp);
waitpid(pid, NULL, 0); waitpid(pid, NULL, 0);