• Athira Rajeev's avatar
    perf tests stat+csv_output: Include sanity check for topology · cd400f6f
    Athira Rajeev authored
    Testcase stat+csv_output.sh fails in powerpc:
    
    	84: perf stat CSV output linter: FAILED!
    
    The testcase "stat+csv_output.sh" verifies perf stat CSV output. The
    test covers aggregation modes like per-socket, per-core, per-die, -A
    (no_aggr mode) along with few other tests. It counts expected fields for
    various commands. For example say -A (i.e, AGGR_NONE mode), expects 7
    fields in the output having "CPU" as first field. Same way, for
    per-socket, it expects the first field in result to point to socket id.
    The testcases compares the result with expected count.
    
    The values for socket, die, core and cpu are fetched from topology
    directory:
    
      /sys/devices/system/cpu/cpu*/topology.
    
    For example, socket value is fetched from "physical_package_id" file of
    topology directory.  (cpu__get_topology_int() in util/cpumap.c)
    
    If a platform fails to fetch the topology information, values will be
    set to -1. For example, incase of pSeries platform of powerpc, value for
    "physical_package_id" is restricted and not exposed. So, -1 will be
    assigned.
    
    Perf code has a checks for valid cpu id in "aggr_printout"
    (stat-display.c), which displays the fields. So, in cases where topology
    values not exposed, first field of the output displaying will be empty.
    This cause the testcase to fail, as it counts  number of fields in the
    output.
    
    Incase of -A (AGGR_NONE mode,), testcase expects 7 fields in the output,
    becos of -1 value obtained from topology files for some, only 6 fields
    are printed. Hence a testcase failure reported due to mismatch in number
    of fields in the output.
    
    Patch here adds a sanity check in the testcase for topology.  Check will
    help to skip the test if -1 value found.
    
    Fixes: 7473ee56 ("perf test: Add checking for perf stat CSV output.")
    Reported-by: default avatarDisha Goel <disgoel@linux.vnet.ibm.com>
    Suggested-by: default avatarIan Rogers <irogers@google.com>
    Suggested-by: default avatarJames Clark <james.clark@arm.com>
    Signed-off-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
    Cc: Claire Jensen <cjense@google.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kajol Jain <kjain@linux.ibm.com>
    Cc: linuxppc-dev@lists.ozlabs.org
    Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
    Link: https://lore.kernel.org/r/20221006155149.67205-1-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    cd400f6f
stat+csv_output.sh 4.42 KB