@@ -5,19 +5,23 @@ function commonSetupOnce(testCase)
55
66% file definitions
77otelcolroot = getenv(" OPENTELEMETRY_COLLECTOR_INSTALL" );
8+ assert(~isempty(otelcolroot ), " OPENTELEMETRY_COLLECTOR_INSTALL environment must be defined." )
89testCase.OtelConfigFile = fullfile(fileparts(mfilename(" fullpath" )), ...
910 " otelcol_config.yml" );
10- testCase.OtelRoot = getenv(" OPENTELEMETRY_MATLAB_INSTALL" );
11+ otelroot = getenv(" OPENTELEMETRY_MATLAB_INSTALL" );
12+ assert(~isempty(otelroot ), " OPENTELEMETRY_MATLAB_INSTALL environment must be defined." )
13+ testCase.OtelRoot = otelroot ;
1114testCase.JsonFile = " myoutput.json" ;
1215testCase.PidFile = " testoutput.txt" ;
1316
1417% process definitions
15- testCase.Otelcol = fullfile( otelcolroot , " otelcol" ) ;
18+ testCase.OtelcolName = " otelcol" ;
1619if ispc
1720 testCase.ListPid = @(name )"tasklist / fi " " IMAGENAME eq " + name + " .exe"" " ;
1821 testCase.ReadPidList = @(file )readtable(file , " VariableNamingRule" , " preserve" , " NumHeaderLines" , 3 , " MultipleDelimsAsOne" , true , " Delimiter" , " " );
1922 testCase.ExtractPid = @(table )table .Var2 ;
2023 windows_killroot = string(getenv(" WINDOWS_KILL_INSTALL" ));
24+ assert(~isempty(windows_killroot ), " WINDOWS_KILL_INSTALL environment must be defined." )
2125 testCase.Sigint = @(id )fullfile(windows_killroot ," windows-kill" ) + " -SIGINT " + id ;
2226 testCase.Sigterm = @(id )"taskkill / pid " + id;
2327elseif isunix && ~ismac
@@ -26,7 +30,19 @@ function commonSetupOnce(testCase)
2630 testCase.ExtractPid = @(table )table .PID ;
2731 testCase.Sigint = @(id )"kill " + id; % kill sends a SIGTERM instead of SIGINT but turns out this is sufficient to terminate OTEL collector on Linux
2832 testCase.Sigterm = @(id)" kill " + id ;
33+ elseif ismac
34+ testCase.ListPid = @(name )"pgrep - x " + name;
35+ testCase.ReadPidList = @readmatrix;
36+ testCase.ExtractPid = @(x)x; % no-op that returns itself
37+ testCase.Sigint = @(id)" kill -s INT " + id ;
38+ testCase.Sigterm = @(id )"kill - s TERM " + id;
39+ if computer == " MACA64"
40+ % only the contrib version of OpenTelemetry Collector is available on Apple silicon
41+ testCase.OtelcolName = " otelcol-contrib" ;
42+ end
43+
2944end
45+ testCase.Otelcol = fullfile(otelcolroot , testCase .OtelcolName );
3046
3147% set up path
3248testCase .applyFixture(matlab .unittest .fixtures .PathFixture(testCase .OtelRoot ));
0 commit comments