File tree Expand file tree Collapse file tree 5 files changed +16
-7
lines changed Expand file tree Collapse file tree 5 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ function metrics_example(iterations)
1818u = createUpDownCounter(m , " updowncounter" );
1919h = createHistogram(m , " histogram" );
2020
21+ % wait a little before starting
22+ pause(2 );
2123for i = 1 : iterations
2224 c .add(randi(10 ));
2325 u .add(randi([-10 10 ]));
Original file line number Diff line number Diff line change @@ -260,8 +260,8 @@ function testWebread(testCase)
260260 server = fullfile(serverfolder , " webread_example_server" );
261261
262262 % start the C++ server
263- % system(server + '&');
264263 testCase .applyFixture(CppServerFixture(server , testCase ));
264+ pause(3 ); % wait a little for server to start up
265265
266266 % run the example
267267 webread_example();
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ function commonTeardown(testCase)
33
44% Copyright 2023-2024 The MathWorks, Inc.
55
6- % Terminate Collector if it is still running
7- terminateProcess(testCase , testCase .OtelcolName );
6+ % Terminate Collector if it is still running. Use interrupt signal.
7+ terminateProcess(testCase , testCase .OtelcolName , testCase . Sigint );
88
99% Close command window if opened
1010closeWindow(testCase );
Original file line number Diff line number Diff line change 33
44% Copyright 2023-2024 The MathWorks, Inc.
55
6- % terminate the collector
7- terminateProcess(testCase , testCase .OtelcolName );
6+ % terminate the collector, using interrupt signal
7+ terminateProcess(testCase , testCase .OtelcolName , testCase . Sigint );
88
99assert(exist(testCase .JsonFile , " file" ));
1010
Original file line number Diff line number Diff line change 1- function terminateProcess(testCase , process )
1+ function terminateProcess(testCase , process , terminatecmd )
22% Terminate a process started in a test
33
44% Copyright 2023-2024 The MathWorks, Inc.
55
6+ if nargin < 3
7+ terminatecmd = testCase .Sigterm ; % defaults to terminate signal
8+ end
9+
610system(testCase .ListPid(process ) + " > " + testCase .PidFile );
711tbl = testCase .ReadPidList(testCase .PidFile );
812pid = testCase .ExtractPid(tbl );
913retry = 0 ;
1014% sometimes kill will fail with a RuntimeError: windows-kill-library: ctrl-routine:findAddress:checkAddressIsNotNull
1115% Retry up to 3 times
1216while ~isempty(pid ) && retry < 4
13- system(testCase .Sigint(pid ));
17+ % kill all if multiple instances found
18+ for i = 1 : numel(pid )
19+ system(terminatecmd(pid(i )));
20+ end
1421 pause(2 ); % give a little time for the collector to shut down
1522 system(testCase .ListPid(process ) + " > " + testCase .PidFile );
1623 tbl = testCase .ReadPidList(testCase .PidFile );
You can’t perform that action at this time.
0 commit comments