Instead of relying on a custom global_setup and global_teardown
functions, migrate to the use of bats' setup_file and teardown_file
functions.
Signed-off-by: William Douglas <william.douglas@intel.com>
Environment variables are used everywhere in testilb. This environment
variables are global variables that define the way testlib behaves.
However is was confusing to use the variables because they were
inconsistent between each other, for example some variables that define
paths would have absolute paths while other would have relative paths,
making it error prone while using them.
This commit makes the environment variables more consistent by following
a name convention for each type of variable, as an example, variables
that define absolute paths follow this convention ABS_<path_name>_DIR,
while variables that define relative paths are defined like this
<path_name>_DIR.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Current implementation was only removing test enviroment for envs created
on test setup. And test_teardown function needed to be overriden in case
global_setup() was used.
Now always cleaning the enviroment for both use cases, test_setup() and
global_setup(). The user doesn't have the control anymore on that and
if the user wants to keep the env KEEP_ENV variable should be used.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Test environment can be created on global_setup() or test_setup() and that
change the behavior of several operations on testlib.
Because of that, let the user create the test environment as desired instead
of forcing it on test_setup()
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This patch adds 2 scripts used to balance test execution. The weight_tests.bash
runs all tests and sets a weight to them based on how long they take to run. The
other, filter_bats_list.bash, use this information to split the tests in groups to
be executed by github actions.
When a new test is added the script will consider it with an average weight, so this
shouldn't unbalance the system right away. After some time, if we notice that the
system is not balanced anymore we can just run the weight_tests.bash again to rebalance.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Print a "Validate downloaded files" message to separate 2 different progress bars
and improve the output when downloading extra fullfiles
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Reorganize bundle add main function to reuse more code and improve performance.
Stopped using subscription code from bundles and now using a new function to
recurse manifests, gaining around 30% cpu time on manifest processing.
Started using staging code from update and preventing checking hashes more than
once for some files on bundle-add operations gaining around of 30% CPU time too.
Overall executions of this new bundle-add uses 30% less CPU time but because this
operation is very IO intensitive this reflects to a gain in around 10% of total
time in systems I tested.
This commit adds a few more cosmetic changes to the commands that run
verify in the back for consistency.
- Different steps in the update process are separated by a blank line.
- Messages from swupd should not finish with a '.'
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Adding messages where swupd could take some time to finish a step so
users know better where the process is at.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit makes use of the swupd_progress_callback() function to
report progress downloading fullfiles based on how much data we have
downloaded vs the number of files downloaded. This callback will only be
used when the number of files to be downloaded are less than MAX_FILES,
calculating the total download size can be very costly if the files are
too many. If the files to be downloaded are more than MAX_FILES we will
fallback to reporting download progress based on file count as before.
When installing bundles or doing updates, swupd creates a list of files
that need to be downloaded. This list may contain files that were
already downloaded via packages and it often does. These files are then
skipped at the moment of downloading them since they are already in the
system. This causes a misleading output that shows the user that
fullfiles will be downloaded when they are actually not.
This commit filters the list of fullfiles to be downloaded to only
contain those ones that actually need to be downloaded.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit makes use of the swupd_progress_callback() function to
report progress downloading packs based on how much data we have
downloaded vs the number of files downloaded.
This commit also fixes a bug in the download_subscribed_packs function.
Swupd was not downloading the correct pack for bundles not installed in
the system that had been recently added as dependency of another
installed bundle.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When swupd is run and the stdout is not a tty (for example when
redirecting the output to a file) the progress of a step is being
reported as a sequence of dots, which is not very useful to really
identify how far in the process we are.
This commit changes that behavior so percentages are used to report
progress when not using a tty instead of dots.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Add a new alias filetype that swupd understands. This file's format is
the following:
A potentially multiline file with an alias name per line followed by,
ont he same line, a list of bundle names with all fields being tab
separated.
If the same alias is defined in the same file, the first definition
will be used. Malformed lines will not be parsed but it is valid to
have multiple concurrent tabs in a line.
The files are to be read from both user and system alias directories
with stateless overrides of system files with user files. This implies
you can mask a system file with a user file of the same name if the
user file is a symlink to /dev/null. You can also override a system
file with a user file of the same name but with different content (the
contents of the system file will be unused). Alias files are
considered in lexicographical order sorted the same as bundle-list. If
two files provide the same alias than the one in the file that comes
first lexicographically will be used. User files will always come
before system files, such that if a user file 'u' defines alias 'a'
and a system file 's' also defines alias 'a' the user file definition
will be used instead of the system file definition.
The intended usage of this will be for OS content to provide alias
files that will then enable users to add content using the provided
aliases as well as enabling users to define their own alias for custom
package groups.
Eventually this feature may be considered for extension to other areas
aside from bundle-add but for now only bundle-add usage is to be
supported.