Skip to content

Commit 0ed1577

Browse files
authored
[integration_test] Add --no-dds option for test (#849)
1 parent e4834fe commit 0ed1577

File tree

1 file changed

+53
-44
lines changed

1 file changed

+53
-44
lines changed

tools/lib/src/device.dart

Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class Device {
2525
this.profile, {
2626
required TizenSdk tizenSdk,
2727
ProcessRunner processRunner = const ProcessRunner(),
28-
}) : _tizenSdk = tizenSdk,
29-
_processRunner = processRunner;
28+
}) : _tizenSdk = tizenSdk,
29+
_processRunner = processRunner;
3030

3131
/// Creates a new physical Tizen device reference.
3232
///
@@ -45,8 +45,10 @@ class Device {
4545
);
4646
device._serial = device._findSerial();
4747
if (device._serial == null) {
48-
throw Exception("$name ($profile)'s serial is null. "
49-
'Physical device references must be connected to host PC.');
48+
throw Exception(
49+
"$name ($profile)'s serial is null. "
50+
'Physical device references must be connected to host PC.',
51+
);
5052
}
5153
return device;
5254
}
@@ -124,7 +126,7 @@ class Device {
124126

125127
final io.Process process = await _processRunner.start(
126128
'flutter-tizen',
127-
<String>['-d', serial!, 'test', 'integration_test'],
129+
<String>['-d', serial!, 'test', '--no-dds', 'integration_test'],
128130
workingDirectory: workingDir,
129131
);
130132

@@ -143,20 +145,18 @@ class Device {
143145

144146
String lastLine = '';
145147
final Completer<int> completer = Completer<int>();
146-
streamLines.listen(
147-
(String line) {
148-
lastLine = line;
149-
print(line);
150-
},
151-
onDone: () async => completer.complete(await timedExitCode),
152-
);
148+
streamLines.listen((String line) {
149+
lastLine = line;
150+
print(line);
151+
}, onDone: () async => completer.complete(await timedExitCode));
153152
// Waits for the done event as finishing `Process.exitCode` future does not
154153
// guarantee that all buffered outputs of the process have returned.
155154
await completer.future;
156155

157156
String? error;
158157
if (timedOut) {
159-
error = 'Timeout expired. The test may need more time to finish. '
158+
error =
159+
'Timeout expired. The test may need more time to finish. '
160160
'If you expect the test to finish before timeout, check if the tests '
161161
'require device screen to be awake or if they require manually '
162162
'clicking the UI button for permissions.';
@@ -166,7 +166,8 @@ class Device {
166166
} else if (lastLine.contains('No devices found')) {
167167
error = 'Device was disconnected during test.';
168168
} else if (lastLine.contains('failed')) {
169-
error = 'flutter-tizen test integration_test failed, see the output '
169+
error =
170+
'flutter-tizen test integration_test failed, see the output '
170171
'above for details.';
171172
} else if (!lastLine.contains('passed')) {
172173
error = 'Could not parse the log output.';
@@ -219,17 +220,19 @@ class EmulatorDevice extends Device {
219220
/// Checks whether the emulator with [name] and [profile] exists
220221
/// in the Emulator Manager.
221222
bool get exists {
222-
final io.ProcessResult result =
223-
_processRunner.runSync(_tizenSdk.emCli.path, <String>['list-vm']);
223+
final io.ProcessResult result = _processRunner.runSync(
224+
_tizenSdk.emCli.path,
225+
<String>['list-vm'],
226+
);
224227
if (result.exitCode != 0) {
225228
print('Error: Unable to list available emulators.');
226229
throw ToolExit(result.exitCode);
227230
}
228231

229232
final List<String> emulatorNames =
230-
LineSplitter.split(result.stdout as String)
231-
.map((String name) => name.trim())
232-
.toList();
233+
LineSplitter.split(
234+
result.stdout as String,
235+
).map((String name) => name.trim()).toList();
233236
return emulatorNames.contains(name);
234237
}
235238

@@ -245,11 +248,13 @@ class EmulatorDevice extends Device {
245248
platform = '$profile-x86';
246249
break;
247250
}
248-
await _processRunner.runAndStream(
249-
_tizenSdk.emCli.path,
250-
<String>['create', '-n', name, '-p', platform],
251-
exitOnError: true,
252-
);
251+
await _processRunner.runAndStream(_tizenSdk.emCli.path, <String>[
252+
'create',
253+
'-n',
254+
name,
255+
'-p',
256+
platform,
257+
], exitOnError: true);
253258
}
254259

255260
/// Grants all privacy-related permissions to apps by default.
@@ -274,27 +279,35 @@ class EmulatorDevice extends Device {
274279
return false;
275280
}
276281

277-
result = _processRunner.runSync(
278-
_tizenSdk.sdb.path,
279-
<String>['-s', serial!, 'shell', 'touch', '/opt/share/askuser_disable'],
280-
);
282+
result = _processRunner.runSync(_tizenSdk.sdb.path, <String>[
283+
'-s',
284+
serial!,
285+
'shell',
286+
'touch',
287+
'/opt/share/askuser_disable',
288+
]);
281289
final String stdout = result.stdout as String;
282290
if (result.exitCode != 0 || stdout.trim().isNotEmpty) {
283291
print('Error: running sdb shell command failed: $stdout');
284292
return false;
285293
}
286294

287-
_processRunner.runSync(
288-
_tizenSdk.sdb.path,
289-
<String>['-s', serial!, 'root', 'off'],
290-
);
295+
_processRunner.runSync(_tizenSdk.sdb.path, <String>[
296+
'-s',
297+
serial!,
298+
'root',
299+
'off',
300+
]);
291301
return true;
292302
}
293303

294304
/// Deletes this emulator.
295305
Future<void> delete() async {
296-
await _processRunner
297-
.runAndStream(_tizenSdk.emCli.path, <String>['delete', '-n', name]);
306+
await _processRunner.runAndStream(_tizenSdk.emCli.path, <String>[
307+
'delete',
308+
'-n',
309+
name,
310+
]);
298311
}
299312

300313
/// Launches this emualtor.
@@ -303,11 +316,11 @@ class EmulatorDevice extends Device {
303316
print('Device $name ($profile) is already launched.');
304317
return;
305318
}
306-
await _processRunner.runAndStream(
307-
_tizenSdk.emCli.path,
308-
<String>['launch', '-n', name],
309-
exitOnError: true,
310-
);
319+
await _processRunner.runAndStream(_tizenSdk.emCli.path, <String>[
320+
'launch',
321+
'-n',
322+
name,
323+
], exitOnError: true);
311324

312325
await _poll(() {
313326
final List<SdbDeviceInfo> deviceInfos = _tizenSdk.sdbDevices();
@@ -335,11 +348,7 @@ class EmulatorDevice extends Device {
335348
return;
336349
}
337350
// TODO(HakkyuKim): Support Windows.
338-
await _processRunner.run(
339-
'kill',
340-
<String>['-9', _pid!],
341-
exitOnError: true,
342-
);
351+
await _processRunner.run('kill', <String>['-9', _pid!], exitOnError: true);
343352

344353
await _poll(() {
345354
final List<SdbDeviceInfo> deviceInfos = _tizenSdk.sdbDevices();

0 commit comments

Comments
 (0)