blob: 286a3f3af82cacb5f49c2253dd19bdffdf0cddac [file]
# Copyright 2019 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
from __future__ import annotations
DEPS = [
'context',
'futures',
'path',
'step',
]
def Level2(api, i):
work = []
with api.step.nest('Level2 [%d]' % i):
with api.context(cwd=api.path.start_dir / 'deep'):
work.append(api.futures.spawn(
api.step, 'cool step', cmd=['echo', 'cool']))
# Specifically wait outside all the contexts; if they have a bug w.r.t. global
# state vs. greenlet-local state, we'll see it here with bad context.
api.futures.wait(work)
def Level1(api, i):
with api.step.nest('Level1 [%d]' % i):
for j in range(4):
api.futures.spawn(Level2, api, j)
def RunSteps(api):
for i in range(4):
api.futures.spawn(Level1, api, i)
def GenTests(api):
yield api.test('basic')