Hello Everyone,
I'm working on changing the command sequence right now so it works better
with the new parser design and I have several ideas I'd like to
share/discuss here.
Change <command_sequence> to <task>
===================================
The first one is to rename the <command_sequence> tag to <task>. I
wanted to add more semantics to the very general command sequence tag
with the test fixtures proposal. However, after a deeper discussion,
we agreed that it might be too limiting and even confusing in some cases.
Task, on the other hand is not limiting at all. It can be used the same
way command sequences are at the moment, but the name is less abstract
and it suggests that each "task" should do only one thing.
There could be several types of tasks with different properties. For
example:
<task type="setup">
this type of task would have quit_on_fail=1
<task type="test">
quit_on_fail=0
<task type="teardown">
quit_on_fail=1, but finish the whole task before exiting
(we want to do as much cleanup as possible)
The default behaviour would be "test". This means we would get basically
all the benefits from test fixtures without losing the variability of
command sequences. It also works very well if you try to explain what
LNST actually does (you need to specify what infrastructure you need for
the test and the tasks you'd like to run).
Change type="exec" && type="test" to <run>
==========================================
The other change I'd like to do is to move all the three tags that we
use to run some commands/test_modules/test_tools under a single tag
called <run>. It would look something like this:
Shell commands (former type="exec"):
<run command="sleep 5" machine="1">
Test tools (former type="exec" from="tool"):
<run from="tool" command="./mighty_tool"
machine="1">
Test modules (former type="test"):
<run module="IcmpPing" machine="1">
<options/>
</run>
This would be nice, in my opinion, because there would be only a single
way to run something from the recipe.
Slight modification of intr, kill, wait, and ctl_wait
=====================================================
These are all right in my opinion, I only changed the attribute from
'value' to something else:
<intr machine="1" id="5">
<kill machine="1" id="5">
<wait machine="1" id="5">
value was changed to id
<ctl_wait seconds="5">
value changed to seconds
Change type="system_config" to <config>
==================================
We used system_config to differentiate from the other configs that vere
present in the past in the LNST recipe. However, they are all gone now,
so we could shorten the system config to simply config:
<config option="/proc/sys/lol" value="10">
With these changes the <command_sequence>s/<tasks> are really a sequences
of commands, because each tag name is a verb that represents the action
that will be done:
config, run, run, ctl_wait, wait, intr, kill ...
Scopes for processes and configuration
======================================
Additionally, what we'll have to change is the limitation of lifetime of
a process to only a single task. We already have something similar with
system_config settings using the "persistent" attribute.
We could unify both things and define "scopes" for both the <config> and
the <run> tag. The default value would be "local", but in case the
setting/process should last longer than the command sequence, the user
could set the scope to "global". For instance:
<task type="setup">
<config option="name" value="5"
scope="global">
<run command="tcpdump -i eth0" bg_id="tcpdump"
scope="global">
</task>
<task type="test"/>
<task type="test"/>
<task type="teardown">
<config option="name" value="0"
scope="global">
<kill id="tcpdump">
</task>
Another alternative to this could be:
lifetime="local"
lifetime="unlimited"
What do you think?
Any feedback is greatly appreciated :-).
Cheers,
-Radek