[Avocado-devel] Avocado 101 questions

Fajun Chen fajun.chen at seagate.com
Wed Feb 13 04:41:55 UTC 2019


Hi Lukas,

Thanks for the feedback. Our focus at this point is on proof-of-concept to
identify what are the things Avocado can and can't do. Will come back later
on the proper implementation of specific features.

Based on early discussions, the sequence capability provided by yaml loader
is still very limited. Is there any way to call Avocado tests from Python
code directly so we can have full control over the test sequence?

Thanks,
Fajun



On Fri, Feb 8, 2019 at 9:09 AM Lukáš Doktor <ldoktor at redhat.com> wrote:

> Dne 06. 02. 19 v 7:22 Fajun Chen napsal(a):
> > Hi Lukas,
> >
> > As an experiment, I made the following changes to avocado/core/runner.py:
> > @@ -319,7 +319,7 @@
> >          # be able to read from the tty, and would hang. Let's replace
> >          # STDIN fd (0), with the same fd previously set by
> >          # `multiprocessing.Process()`
> > -        os.dup2(sys.stdin.fileno(), 0)
> > +        # os.dup2(sys.stdin.fileno(), 0)
> >
> >          instance = loader.load_test(test_factory)
> >          if instance.runner_queue is None:
> > @@ -349,7 +349,10 @@
> >                          TEST_LOG.info('  %s: %s', source, location)
> >                  TEST_LOG.info('')
> >          try:
> > +            sys.stdin = open(0)
> >              instance.run_avocado()
> > +            sys.stdin.close()
> > +            sys.stdin = open(os.devnull)
> >          finally:
> >              try:
> >                  state = instance.get_state()
> >
> > I can interact with the test manually with the change. Understood the
> risk
> > of keeping stdin fd open, but will it be manageable if our tests don't
> read
> > from tty unless it's warranted?
> >
> > Thanks,
> > Fajun
>
> Hello Fajun,
>
> sure, this will work for now (although failures are not handled), anyway
> if you decide to use Avocado I'd suggest the RFC or at least to open a
> discussion to have a proper implementation. I can imagine something like:
>
> ```
> avocado run interactive.py --enable-stdin
> JOB ID     : 8e9a0a9011d3e4b31d0fee5c2f727e32cf08ec7a
> JOB LOG    :
> /home/medic/avocado/job-results/job-2019-02-08T17.05-8e9a0a9/job.log
>  (1/1) interactive.py:InteractiveTest.test:
> Waiting on stdin on localhost:12345 \
> PASS (75.75 s)
> RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 |
> CANCEL 0
> JOB TIME   : 75.88 s
> JOB HTML   :
> /home/medic/avocado/job-results/job-2019-02-08T17.05-8e9a0a9/results.html
> ```
>
> (or even to use STDIN directly, but as one would perhaps like to see the
> stdout as well I think it'd be better to use socket and pipe in/out/err
> there...)
>
> Regards,
> Lukáš
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/avocado-devel/attachments/20190212/79e81aa8/attachment.htm>


More information about the Avocado-devel mailing list