diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-04-22 23:42:43 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-04-22 23:42:44 +0300 |
commit | 810dc6481ad7c1e1a6aacebfeaed308778c6c63f (patch) | |
tree | 6b4fc05249dba2e535d9fe89a6c130a43aee129a /t | |
parent | 0c601052a5f761fd9c207a56ae11789c8598e25d (diff) | |
parent | 3d3adaad914441a6e7b916eb8dfd5ae638aab068 (diff) |
Merge branch 'js/trace2-env-vars'
Trace2 enhancement to allow logging of the environment variables.
* js/trace2-env-vars:
trace2: teach Git to log environment variables
Diffstat (limited to 't')
-rw-r--r-- | t/helper/test-tool.c | 1 | ||||
-rwxr-xr-x | t/t0212-trace2-event.sh | 37 |
2 files changed, 38 insertions, 0 deletions
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c index 31eedcd241..5f395972c0 100644 --- a/t/helper/test-tool.c +++ b/t/helper/test-tool.c @@ -112,6 +112,7 @@ int cmd_main(int argc, const char **argv) argc--; trace2_cmd_name(cmds[i].name); trace2_cmd_list_config(); + trace2_cmd_list_env_vars(); return cmds[i].fn(argc, argv); } } diff --git a/t/t0212-trace2-event.sh b/t/t0212-trace2-event.sh index 7065a1b937..1529155cf0 100755 --- a/t/t0212-trace2-event.sh +++ b/t/t0212-trace2-event.sh @@ -199,6 +199,43 @@ test_expect_success JSON_PP 'event stream, list config' ' test_cmp expect actual ' +# Test listing of all "interesting" environment variables. + +test_expect_success JSON_PP 'event stream, list env vars' ' + test_when_finished "rm trace.event actual expect" && + GIT_TRACE2_EVENT="$(pwd)/trace.event" \ + GIT_TRACE2_ENV_VARS="A_VAR,OTHER_VAR,MISSING" \ + A_VAR=1 OTHER_VAR="hello world" test-tool trace2 001return 0 && + perl "$TEST_DIRECTORY/t0212/parse_events.perl" <trace.event >actual && + sed -e "s/^|//" >expect <<-EOF && + |VAR1 = { + | "_SID0_":{ + | "argv":[ + | "_EXE_", + | "trace2", + | "001return", + | "0" + | ], + | "exit_code":0, + | "hierarchy":"trace2", + | "name":"trace2", + | "params":[ + | { + | "param":"A_VAR", + | "value":"1" + | }, + | { + | "param":"OTHER_VAR", + | "value":"hello world" + | } + | ], + | "version":"$V" + | } + |}; + EOF + test_cmp expect actual +' + test_expect_success JSON_PP 'basic trace2_data' ' test_when_finished "rm trace.event actual expect" && GIT_TRACE2_EVENT="$(pwd)/trace.event" test-tool trace2 006data test_category k1 v1 test_category k2 v2 && |