Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
24207183
Unverified
Commit
24207183
authored
Sep 15, 2021
by
Ian Hickson
Committed by
GitHub
Sep 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove our extra timeout logic. (#89952)
parent
5d9afaa0
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
136 additions
and
276 deletions
+136
-276
timeout_fail_test.dart
dev/automated_tests/test_smoke_test/timeout_fail_test.dart
+0
-13
timeout_pass_test.dart
dev/automated_tests/test_smoke_test/timeout_pass_test.dart
+0
-13
analyze.dart
dev/bots/analyze.dart
+2
-2
test.dart
dev/bots/test.dart
+59
-76
test_test.dart
dev/bots/test/test_test.dart
+5
-5
accessibility_test.dart
...ration_tests/flutter_gallery/test/accessibility_test.dart
+0
-33
generated_plugin_registrant.cc
...er_gallery/windows/flutter/generated_plugin_registrant.cc
+3
-3
backdrop_filter_test.dart
packages/flutter/test/widgets/backdrop_filter_test.dart
+0
-2
widget_inspector_test.dart
packages/flutter/test/widgets/widget_inspector_test.dart
+1
-1
binding.dart
packages/flutter_test/lib/src/binding.dart
+50
-103
widget_tester.dart
packages/flutter_test/lib/src/widget_tester.dart
+11
-17
integration_test.dart
packages/integration_test/lib/integration_test.dart
+5
-8
No files found.
dev/automated_tests/test_smoke_test/timeout_fail_test.dart
deleted
100644 → 0
View file @
5d9afaa0
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'flutter_test timeout logic - addTime - negative'
,
(
WidgetTester
tester
)
async
{
await
tester
.
runAsync
(()
async
{
await
Future
<
void
>.
delayed
(
const
Duration
(
milliseconds:
3500
));
// must be more than 1000ms more than the initial timeout
},
additionalTime:
const
Duration
(
milliseconds:
200
));
},
initialTimeout:
const
Duration
(
milliseconds:
2000
));
}
dev/automated_tests/test_smoke_test/timeout_pass_test.dart
deleted
100644 → 0
View file @
5d9afaa0
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'flutter_test timeout logic - addTime - positive'
,
(
WidgetTester
tester
)
async
{
await
tester
.
runAsync
(()
async
{
await
Future
<
void
>.
delayed
(
const
Duration
(
milliseconds:
2500
));
// must be longer than initial timeout below.
},
additionalTime:
const
Duration
(
milliseconds:
2000
));
// initial timeout is 2s, so this makes it 4s.
},
initialTimeout:
const
Duration
(
milliseconds:
2000
));
}
dev/bots/analyze.dart
View file @
24207183
...
...
@@ -568,9 +568,9 @@ Future<void> verifyIntegrationTestTimeouts(String workingDirectory) async {
if (errors.isNotEmpty) {
exitWithError(<String>[
if (errors.length == 1)
'
${bold}
An error was detected when looking at i
mport dependencies within the flutter_tools package
:
$reset
'
'
${bold}
An error was detected when looking at i
ntegration test timeouts
:
$reset
'
else
'
${bold}
Multiple errors were detected when looking at i
mport dependencies within the flutter_tools package
:
$reset
',
'
${bold}
Multiple errors were detected when looking at i
ntegration test timeouts
:
$reset
',
...errors.map((String paragraph) => '
$paragraph
\n
'),
]);
}
...
...
dev/bots/test.dart
View file @
24207183
...
...
@@ -190,83 +190,65 @@ Future<void> _runSmokeTests() async {
// Verify that the tests actually return failure on failure and success on
// success.
final
String
automatedTests
=
path
.
join
(
flutterRoot
,
'dev'
,
'automated_tests'
);
// We run the "pass" and "fail" smoke tests first, and alone, because those
// are particularly critical and sensitive. If one of these fails, there's no
// point even trying the others.
// We want to run the smoketests in parallel, because they each take some time
// to run (e.g. compiling), so we don't want to run them in series, especially
// on 20-core machines. However, we have a race condition, so for now...
// Race condition issue: https://github.com/flutter/flutter/issues/90026
final
List
<
ShardRunner
>
tests
=
<
ShardRunner
>[
()
=>
_runFlutterTest
(
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'pass_test.dart'
),
printOutput:
false
,
),
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'pass_test.dart'
),
printOutput:
false
,
),
()
=>
_runFlutterTest
(
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'fail_test.dart'
),
expectFailure:
true
,
printOutput:
false
,
),
()
=>
_runFlutterTest
(
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'pending_timer_fail_test.dart'
),
expectFailure:
true
,
printOutput:
false
,
outputChecker:
(
CommandResult
result
)
{
return
result
.
flattenedStdout
!.
contains
(
'failingPendingTimerTest'
)
?
null
:
'Failed to find the stack trace for the pending Timer.
\n\n
'
'stdout:
\n
${result.flattenedStdout}
\n\n
'
'stderr:
\n
${result.flattenedStderr}
'
;
}),
()
=>
_runFlutterTest
(
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'crash1_test.dart'
),
expectFailure:
true
,
printOutput:
false
,
),
()
=>
_runFlutterTest
(
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'crash2_test.dart'
),
expectFailure:
true
,
printOutput:
false
,
),
()
=>
_runFlutterTest
(
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'fail_test.dart'
),
expectFailure:
true
,
printOutput:
false
,
),
// We run the timeout tests individually because they are timing-sensitive.
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'syntax_error_test.broken_dart'
),
expectFailure:
true
,
printOutput:
false
,
),
()
=>
_runFlutterTest
(
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'timeout_pass_test.
dart'
),
expectFailure:
fals
e
,
printOutput:
false
,
),
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'missing_import_test.broken_
dart'
),
expectFailure:
tru
e
,
printOutput:
false
,
),
()
=>
_runFlutterTest
(
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'timeout_fail_test.dart'
),
expectFailure:
true
,
printOutput:
false
,
),
()
=>
_runFlutterTest
(
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'pending_timer_fail_test.dart'
),
expectFailure:
true
,
printOutput:
false
,
outputChecker:
(
CommandResult
result
)
{
return
result
.
flattenedStdout
!.
contains
(
'failingPendingTimerTest'
)
?
null
:
'Failed to find the stack trace for the pending Timer.'
;
}),
// We run the remaining smoketests in parallel, because they each take some
// time to run (e.g. compiling), so we don't want to run them in series,
// especially on 20-core machines...
()
=>
Future
.
wait
<
void
>(
<
Future
<
void
>>[
_runFlutterTest
(
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'crash1_test.dart'
),
expectFailure:
true
,
printOutput:
false
,
),
_runFlutterTest
(
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'crash2_test.dart'
),
expectFailure:
true
,
printOutput:
false
,
),
_runFlutterTest
(
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'syntax_error_test.broken_dart'
),
expectFailure:
true
,
printOutput:
false
,
),
_runFlutterTest
(
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'missing_import_test.broken_dart'
),
expectFailure:
true
,
printOutput:
false
,
),
_runFlutterTest
(
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'disallow_error_reporter_modification_test.dart'
),
expectFailure:
true
,
printOutput:
false
,
),
],
),
automatedTests
,
script:
path
.
join
(
'test_smoke_test'
,
'disallow_error_reporter_modification_test.dart'
),
expectFailure:
true
,
printOutput:
false
,
),
];
List
<
ShardRunner
>
testsToRun
;
...
...
@@ -785,8 +767,9 @@ Future<void> _runFrameworkTests() async {
outputChecker:
(
CommandResult
result
)
{
final
Iterable
<
Match
>
matches
=
httpClientWarning
.
allMatches
(
result
.
flattenedStdout
!);
if
(
matches
==
null
||
matches
.
isEmpty
||
matches
.
length
>
1
)
{
return
'Failed to print warning about HttpClientUsage, or printed it too many times.
\n
'
'stdout:
\n
${result.flattenedStdout}
'
;
return
'Failed to print warning about HttpClientUsage, or printed it too many times.
\n\n
'
'stdout:
\n
${result.flattenedStdout}
\n\n
'
'stderr:
\n
${result.flattenedStderr}
'
;
}
return
null
;
},
...
...
@@ -1773,9 +1756,9 @@ List<T> _selectIndexOfTotalSubshard<T>(List<T> tests, {String subshardKey = kSub
exit
(
1
);
}
final
int
testsPerShard
=
tests
.
length
~/
total
;
final
int
testsPerShard
=
(
tests
.
length
/
total
).
ceil
()
;
final
int
start
=
(
index
-
1
)
*
testsPerShard
;
final
int
end
=
index
*
testsPerShard
;
final
int
end
=
math
.
min
(
index
*
testsPerShard
,
tests
.
length
)
;
print
(
'Selecting subshard
$index
of
$total
(range
${start + 1}
-
$end
of
${tests.length}
)'
);
return
tests
.
sublist
(
start
,
end
);
...
...
dev/bots/test/test_test.dart
View file @
24207183
...
...
@@ -109,19 +109,19 @@ void main() {
}
test
(
'subshards tests correctly'
,
()
async
{
// When updating this test, try to pick shard numbers that ensure we're checking
// that unequal test distributions don't miss tests.
ProcessResult
result
=
await
runScript
(
<
String
,
String
>{
'SHARD'
:
'smoke_tests'
,
'SUBSHARD'
:
'1_3'
},
);
expectExitCode
(
result
,
0
);
// There are currently 6 smoke tests. This shard should contain test 1 and 2.
expect
(
result
.
stdout
,
contains
(
'Selecting subshard 1 of 3 (range 1-2 of 6)'
));
expect
(
result
.
stdout
,
contains
(
'Selecting subshard 1 of 3 (range 1-3 of 8)'
));
result
=
await
runScript
(
<
String
,
String
>{
'SHARD'
:
'smoke_tests'
,
'SUBSHARD'
:
'
5_6
'
},
<
String
,
String
>{
'SHARD'
:
'smoke_tests'
,
'SUBSHARD'
:
'
3_3
'
},
);
expectExitCode
(
result
,
0
);
// This shard should contain only test 5.
expect
(
result
.
stdout
,
contains
(
'Selecting subshard 5 of 6 (range 5-5 of 6)'
));
expect
(
result
.
stdout
,
contains
(
'Selecting subshard 3 of 3 (range 7-8 of 8)'
));
});
test
(
'exits with code 1 when SUBSHARD index greater than total'
,
()
async
{
...
...
dev/integration_tests/flutter_gallery/test/accessibility_test.dart
View file @
24207183
This diff is collapsed.
Click to expand it.
dev/integration_tests/flutter_gallery/windows/flutter/generated_plugin_registrant.cc
View file @
24207183
...
...
@@ -6,9 +6,9 @@
#include "generated_plugin_registrant.h"
#include <url_launcher_windows/url_launcher_
plugin
.h>
#include <url_launcher_windows/url_launcher_
windows
.h>
void
RegisterPlugins
(
flutter
::
PluginRegistry
*
registry
)
{
UrlLauncher
Plugin
RegisterWithRegistrar
(
registry
->
GetRegistrarForPlugin
(
"UrlLauncher
Plugin
"
));
UrlLauncher
Windows
RegisterWithRegistrar
(
registry
->
GetRegistrarForPlugin
(
"UrlLauncher
Windows
"
));
}
packages/flutter/test/widgets/backdrop_filter_test.dart
View file @
24207183
...
...
@@ -13,7 +13,6 @@ import 'package:flutter_test/flutter_test.dart';
void
main
(
)
{
testWidgets
(
"BackdropFilter's cull rect does not shrink"
,
(
WidgetTester
tester
)
async
{
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
15
));
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
@@ -51,7 +50,6 @@ void main() {
});
testWidgets
(
'BackdropFilter blendMode on saveLayer'
,
(
WidgetTester
tester
)
async
{
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
15
));
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
packages/flutter/test/widgets/widget_inspector_test.dart
View file @
24207183
...
...
@@ -2522,7 +2522,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final
ui
.
Codec
codec
=
await
ui
.
instantiateImageCodec
(
base64
.
decode
(
base64Screenshot
));
final
ui
.
FrameInfo
frame
=
await
codec
.
getNextFrame
();
return
frame
.
image
;
}
,
additionalTime:
const
Duration
(
seconds:
11
)
))!;
}))!;
await
expectLater
(
screenshotImage
,
...
...
packages/flutter_test/lib/src/binding.dart
View file @
24207183
This diff is collapsed.
Click to expand it.
packages/flutter_test/lib/src/widget_tester.dart
View file @
24207183
...
...
@@ -82,23 +82,13 @@ E? _lastWhereOrNull<E>(Iterable<E> list, bool Function(E) test) {
/// The callback can be asynchronous (using `async`/`await` or
/// using explicit [Future]s).
///
/// There are two kinds of timeouts that can be specified. The `timeout`
/// argument specifies the backstop timeout implemented by the `test` package.
/// If set, it should be relatively large (minutes). It defaults to ten minutes
/// for tests run by `flutter test`, and is unlimited for tests run by `flutter
/// run`; specifically, it defaults to
/// [TestWidgetsFlutterBinding.defaultTestTimeout].
///
/// The `initialTimeout` argument specifies the timeout implemented by the
/// `flutter_test` package itself. If set, it may be relatively small (seconds),
/// as it is automatically increased for some expensive operations, and can also
/// be manually increased by calling
/// [AutomatedTestWidgetsFlutterBinding.addTime]. The effective maximum value of
/// this timeout (even after calling `addTime`) is the one specified by the
/// `timeout` argument.
///
/// In general, timeouts are race conditions and cause flakes, so best practice
/// is to avoid the use of timeouts in tests.
/// The `timeout` argument specifies the backstop timeout implemented by the
/// `test` package. If set, it should be relatively large (minutes). It defaults
/// to ten minutes for tests run by `flutter test`, and is unlimited for tests
/// run by `flutter run`; specifically, it defaults to
/// [TestWidgetsFlutterBinding.defaultTestTimeout]. (The `initialTimeout`
/// parameter has no effect. It was previously used with
/// [TestWidgetsFlutterBinding.addTime] but that feature was removed.)
///
/// If the `semanticsEnabled` parameter is set to `true`,
/// [WidgetTester.ensureSemantics] will have been called before the tester is
...
...
@@ -138,6 +128,10 @@ void testWidgets(
WidgetTesterCallback
callback
,
{
bool
?
skip
,
test_package
.
Timeout
?
timeout
,
@Deprecated
(
'This parameter has no effect. Use `timeout` instead. '
'This feature was deprecated after v2.6.0-1.0.pre.'
)
Duration
?
initialTimeout
,
bool
semanticsEnabled
=
true
,
TestVariant
<
Object
?>
variant
=
const
DefaultTestVariant
(),
...
...
packages/integration_test/lib/integration_test.dart
View file @
24207183
...
...
@@ -214,13 +214,16 @@ https://flutter.dev/docs/testing/integration-tests#testing-on-firebase-test-lab
Future
<
void
>
Function
()
testBody
,
VoidCallback
invariantTester
,
{
String
description
=
''
,
@Deprecated
(
'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
'This feature was deprecated after v2.6.0-1.0.pre.'
)
Duration
?
timeout
,
})
async
{
await
super
.
runTest
(
testBody
,
invariantTester
,
description:
description
,
timeout:
timeout
,
);
results
[
description
]
??=
_success
;
}
...
...
@@ -411,13 +414,7 @@ https://flutter.dev/docs/testing/integration-tests#testing-on-firebase-test-lab
}
@override
Timeout
get
defaultTestTimeout
=>
_defaultTestTimeout
??
super
.
defaultTestTimeout
;
/// Configures the default timeout for [testWidgets].
///
/// See [TestWidgetsFlutterBinding.defaultTestTimeout] for more details.
set
defaultTestTimeout
(
Timeout
timeout
)
=>
_defaultTestTimeout
=
timeout
;
Timeout
?
_defaultTestTimeout
;
Timeout
defaultTestTimeout
=
Timeout
.
none
;
@override
void
attachRootWidget
(
Widget
rootWidget
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment