2016-03-10 14:04:58

by Taeung Song

[permalink] [raw]
Subject: [TEST REPORT][PATCH] perf config: Introduce perf_config_set class

Tested-by: Taeung Song <[email protected]>
Test-Date: 2016-03-10
Version: perf version 4.5.rc2.g8c497f
Kernel: 4.5.0-rc4+
Distro: Ubuntu 15.10 wily

Test Environment:

1. Perf PATH

# whereis perf
perf: /usr/local/bin/perf /usr/local/share/man/man1/perf.1.gz

2. User config file

# cat ~/.perfconfig
[report]
queue-size = 1
[call-graph]
threshold = 2.0
[test]
location = user
[top]
children = false

3. System config file

# cat /usr/local/etc/perfconfig
[ui]
show-headers = false
[test]
location = system
[top]
children = true

Test Results:

Case 0) BASIC: perf_config() function work normally

# cat ~/.perfconfig
[colors]
top = blue, white

# perf top
(omitted output, there isn't any problem)

Case 1) BASIC: List functionality without a specific file
(equal with user + system config,
but user config has order of priority)

# cat ~/.perfconfig
[report]
queue-size = 1
[call-graph]
threshold = 2.0
[test]
location = user
[top]
children = false

# perf config --list
ui.show-headers=false
call-graph.threshold=2.0
report.queue-size=1
top.children=false
test.location=user

Case 2) BASIC: List functionality with user config file

# perf config --user --list
call-graph.threshold=2.0
report.queue-size=1
top.children=false
test.location=user

Case 3) BASIC: List functionality with system config file

# perf config --system --list
ui.show-headers=false
top.children=true
test.location=system

Case 4) EXCEP HANDLING: If using two config file at a time

# perf config --user --system --list
Error: only one config file at a time

Usage: perf config [<file-option>] [options]

--user use user config file-
--system use system config file

Case 5) EXCEP HANDLING: user config file : don't exist || permission denied || empty
(user wide ~/.perfconfig)

# perf config --user --list
Nothing configured, please check your /home/taeung/.perfconfig

Case 6) EXCEP HANDLING: system config file : don't exist || permission denied || empty
(system wide /usr/local/etc/perfconfig depending on perf PATH)

# perf config --system --list
Nothing configured, please check your /usr/local/etc/perfconfig

Cc: Namhyung Kim <[email protected]>
Cc: Jiri Olsa <[email protected]>
---
tools/perf/builtin-config.c | 61 +++++++---
tools/perf/util/cache.h | 2 -
tools/perf/util/config.c | 268 +++++++++++++++++++++++++++++++++++++++++---
tools/perf/util/config.h | 138 +++++++++++++++++++++++
4 files changed, 433 insertions(+), 36 deletions(-)
create mode 100644 tools/perf/util/config.h