-
Notifications
You must be signed in to change notification settings - Fork 59
tests: metrics: formalise the metrics reporting methods #955
tests: metrics: formalise the metrics reporting methods #955
Conversation
@MarioCarrilloA Please take a look as well. |
tests/lib/send_results.sh
Outdated
fi | ||
|
||
if [ -z "$IMG" ];then | ||
IMG="$(readlink "$cc_img_path/clear-containers.img")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use @CONTAINERS_IMG@
to prevent hardcoding the path to /usr/share/clear-containers
and add this file to list of generated files in the Makefile.am
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Was aware of the hardcoding. I'll look at moving to a .in
file. I may pick up #945 before I do that then to make development easier (I was hoping to delay that for a bit, oh well ;-)
tests/lib/send_results.sh
Outdated
fi | ||
|
||
if [ -z "$KERNEL" ];then | ||
KERNEL="$(readlink "$cc_img_path/vmlinux.container")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, we can use @CONTAINER_KERNEL@
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @chavafg , if we use @CONTAINER_KERNEL@ we are forced to build the project in order to expand that variable right?, I think the PnP tools should run independently the project is build or not, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that is true @MarioCarrilloA , and I am coding a bit of 'backup' into the script right now - but, the ultimate code would locate exactly what runtime the test ran with, and then extract the info about the img file and kernel from that runtime setup. Sadly, we are some way from coding that up today - so, today we will go with @xxx@, and 'adapt'. It may be for now that the person or system who runs the tests may have to set some ENV or command line vars to point to the correct img and kernel files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarioCarrilloA yes, you would need to build the project. For usability, I would say that you are right, you shouldn't need build the whole project for just running the metrics.
But right now other scripts needed here depend from building the project, so you will still need to run make metrics-tests
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #945 the intention being that a simple make target (intermediate step) be introduced so we can just generate the pre-processed files without having to build the whole project.
tests/lib/send_results.sh
Outdated
@@ -0,0 +1,202 @@ | |||
#!/bin/bash | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is missing a license header.
tests/lib/send_results.sh
Outdated
|
||
function save_to_csv() | ||
{ | ||
runtime="/usr/bin/cc-oci-runtime" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path could be incorrect (CentOS for example).
tests/lib/send_results.sh
Outdated
function save_to_csv() | ||
{ | ||
runtime="/usr/bin/cc-oci-runtime" | ||
release_file="/usr/lib/os-release" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path is Clear Linux-specific I think? That files lives in /etc/
on Ubuntu+Fedora for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path works forfor Ubuntu, Fedora and Clear Linux. Seems that CentOS does not have it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and of course if we only check /etc/
, it won't work for clr ;-( It's almost like this needs to be a getent
database... ;-) So maybe special-case CentOS (as it's the oldest)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/lib/send_results.sh
Outdated
cc_img_path="/usr/share/clear-containers" | ||
|
||
if [ -z "$TEST_NAME" ];then | ||
echo "error: test name no found" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Redirect all these error messages to stderr?
- s/test name no/test name not/
In fact, if this script sourced test-common.bash
, you could just call:
die "test name not found"
tests/metrics/README.md
Outdated
This will run all metrics tests and generete a `results` directory. | ||
This will run all metrics tests and place the results in the `lib/metrics/results` directory. | ||
|
||
Each file in the `results` directory contains the result for a test as a comma separated values (CSV). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/comma separated values/comma separated value/
tests/lib/send_results.sh
Outdated
fi | ||
|
||
if [ -z "$UNITS" ];then | ||
echo "error: units no found" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/no found/not found/.
tests/lib/send_results.sh
Outdated
|
||
if [ -z "$TAG" ];then | ||
if [ -f "$runtime" ];then | ||
commit="$(cc-oci-runtime -v | tail -n1 | sed s/"commit: "//g)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we envisage this script even moving to the tests repo? If so, it would be worth creating a variable for the runtime (so we could switch it to cc-runtime
and this test would then become:
$runtime -v|grep "commit.*:"|cut -d: -f2-|tr -d ' '
(works for cc-oci-runtime
and cc-runtime
).
tests/lib/send_results.sh
Outdated
CSV_FILE=${RESULT_DIR}/$(echo ${TEST_NAME} | sed 's/ /-/g').csv | ||
|
||
# Are we dry-running? | ||
if [ -z "$SEND" ];then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of having a dry-run mode, but I'm not really clear what it buys us here. I think it would just perform the checks? It might be worth having it "almost" run the code below by showing would run '...'
using an echo $cmd
and if not in dry-run mode, running eval $cmd
instead.
tests/lib/send_results.sh
Outdated
echo "Timestamp,Group,Name,Args,Result,Units,System,SystemVersion,Platform,Image,Kernel,Commit" > ${CSV_FILE} | ||
fi | ||
|
||
s1=$(echo "$timestamp,$GROUP,$TEST_NAME,$ARGS,$RESULT,$UNITS,$SYSTEM,$SYS_VERSION,$platform,$IMG,$KERNEL,$commit") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly, the code should handle commas in these variables - either error out or quote the values. A simple check might be to echo $1
and count the commas to ensure we have the expected number of fields.
tests/lib/send_results.sh
Outdated
This tool will save results to csv | ||
files. | ||
Options: | ||
-h Help page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good if this list of options was sorted alphabetically 😄
Oh - could you add that |
@jodh-intel thanks for the thorough review - the script was pulled in from another project. I did some mods and cleanups, but looks like there is a bunch more to do to meet our requirements :-) Let me get on that and send a new version soon. |
Jodh - oh, iswym with wanting the fixes in the commit, not the merge/PR message. Hmm, I can - but, personally it feels a bit 'wrong', on a couple of fronts:
Just noting like. I'll follow suit and add the fixes at the next update. |
@grahamwhaley - I can understand that, but -- I think -- for most the workflow is easier if you do have a "Fixes:" comment in one of the commits since you don't need to adjust the PR text and the wokflow becomes minimally:
I take the point about a stack of commits, but I'd tend to mark those that contribute to fixing an issue as "partially fixes #XXX". Again, I understand not wanting to encode github specifics in the branch, but as shown above, it is useful to use a "Fixes:" comment to make life easier for developers. I think it's not unreasonable to have close ties between the version control system and change control systems. The final point is that if we only put the fixes on the PR itself, Flipping it round, I'd say we want to minimise the amount of extra detail we add to a PR description since that isn't stored as history in the git branch. |
d402eee
to
74161ae
Compare
@jodh-intel @chavafg all feedback should have been addressed in the new version. |
and then I spot I've acquired a Makefile.am conflict... so, expect a rebase and another push... |
74161ae
to
60d8b0e
Compare
qa-passed |
1 similar comment
qa-passed |
Looks good from a docs perspective. Awaiting Makefile.am conflict resolution to approve. |
# This is somewhat imperfect. Ideally we'd have knowledge passed | ||
# in from the test itself about which runtime it used so we could | ||
# be certain to have the correct runtime and extract the correct | ||
# commit id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth capturing in an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. Added #973
lgtm |
@chavafg any chance you can re-review so we can move this on? thanks. |
tests/lib/test-common.bash.in
Outdated
die "save_results() requires 4 parameters, not $#" | ||
fi | ||
|
||
$LIB_DIR/send_results.sh -n "$1" -a "$2" -r "$3" -u "$4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the PR and when calling this line I got:
/root/go/src/github.com/01org/cc-oci-runtime/tests/metrics/density/../../lib/test-common.bash: line 80: /root/go/src/github.com/01org/cc-oci-runtime/tests/metrics/density/../../lib/send_results.sh: Permission denied
It can be fixed with:
bash $LIB_DIR/send_results.sh -n "$1" -a "$2" -r "$3" -u "$4"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, indeed, good spot. A side effect of the .in file processing. My local version got chmod'd during test, and then that 'stuck'. thx. will fix and update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Add a new function (save_results) for the metrics tests to migrate to use, which then calls out to a script to do the any actual processing and saving of the results. This is the first step on formalising, documenting and unifying the results reporting method across all the metrics tests. Signed-off-by: Graham Whaley <[email protected]>
Add the send_results.sh.in script that saves the metrics results into csv files under the tests/metrics/results dir. Also add it to the generated files list so it can be pre-processed into a runnable script. Signed-off-by: Graham Whaley <[email protected]>
Now we have some new metrics reporting infrastructure, update the README to expand on that, enabling further use, enhancement and modifications. Fixes: intel#954 Signed-off-by: Graham Whaley <[email protected]>
Move from using the old 'cvs file' reporting functions to the new save_results call. Signed-off-by: Graham Whaley <[email protected]>
60d8b0e
to
5b83071
Compare
Updated @chavafg @jodh-intel.
|
lgtm |
qa-passed |
The metrics report through more than one method at present (csv files, stdout). Add a more formal and flexible method for reporting metrics results so we can then migrate all the metrics over to 'one true method'.
Fixes: #954