15 Commits

Author SHA1 Message Date
William Douglas 776f8c92b0 Update use bats setup and teardown features
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>
2023-02-17 12:58:05 -08:00
Castulo Martinez 7dd6fc221a Testlib: renaming variables for consistency
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>
2020-06-16 11:42:13 -07:00
Otavio Pontes eeb3d61fea testlib: Always remove test enviroment implicitly at the end of tests
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>
2020-04-07 13:52:49 -07:00
Otavio Pontes b1e849327d testlib: never create test enviroment for the user
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>
2020-04-07 13:52:49 -07:00
Otavio Pontes d61288464d tests: Auto rebalance tests based on how long they take to long
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>
2020-02-20 13:22:31 -08:00
Castulo Martinez 41d334e708 Adding IDs to hashdump tests
Adding IDs and minor changes in hashdump tests.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2018-11-19 12:47:23 -08:00
Castulo Martinez bb95381844 Replacing old hashdump tests
The old hashdump tests used the swupdlib.bash library that was
replaced by testlib.bash.

This commit replaces those old hashdump tests with new versions
of the same tests that now use testlib.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2018-09-27 12:48:14 -07:00
Matthew Johnson ae011954f4 Add status checks for test swupd commands
Adds status checks for each swupd command called in the functional
tests. At this point several of these tests fail due to some successful
commands returning error statuses.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-08-10 15:33:59 -07:00
Patrick McCarty a55870ed51 Fix several tests with unchecked output lines
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-11-03 09:32:36 -07:00
Patrick McCarty 0ca1975ed5 Convert all functional tests to the new interface
This commit adds "lines-checked" files for every test that checks
swupd-client output and removes the old bash-array-style checks from
the test scripts.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-11-02 21:02:46 -07:00
Patrick McCarty 2b3af5af08 Update hashdump functional tests
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-09-30 15:18:12 -07:00
Patrick McCarty a384265d88 Refactor test cases; update bundle manifest hashes
This commit expands the swupd BATS library to encapsulate more of the
boilerplate steps in the test cases.

Additionally, bundle manifest hashes needed updating now that swupd is
emitting warnings (and later on, errors). Better to be prepared for the
switch to errors on mismatches.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-06-22 16:12:38 -07:00
William Douglas a52eeb42cb Move functional tests to use the BATS framework 2016-04-26 22:15:04 +00:00
Patrick McCarty 846648382d Fix crash when running hashdump
In a previous commit, the init_globals() call was removed from the
hashdump code, which resulted in path_prefix not being set in case the
--basepath option was not specified, and led to a NULL pointer
dereference.

Fix the issue by calling the new set_path_prefix() function. The NULL
value will honor the --basepath option if specified, or set the default
path_prefix.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-04-08 11:38:05 -07:00
William Douglas 2568e6daf7 Add functional test for hashdump 2016-03-07 14:23:18 -08:00