606 Commits
Author SHA1 Message Date
Otavio Pontes c5435de83f test: Add test to check if file attrs are preserved on updates
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-16 13:52:29 -07:00
Otavio Pontes 669dfe09cf test: Preserve attributes on copy
When creating the fullfile and installing the bundle in targetfs we
need to preserve the owner and mode of file

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-16 13:52:29 -07:00
Otavio Pontes 9edb70023c 3rd-party: xdg env variable has a wrong name
XDG_CONFIG_DIRS variable was added with an incorrect name. XDG_CONF_DIRS was used instead.
Fixing that.

Fix #1443

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-16 13:25:04 -07:00
Castulo Martinez 056137fd4a Fixing progress type on diagnosing extra files
When dealing with extra files during a "verify" action, we cannot really
tell how far in the process we are, so we should be defining that step
as PROGRESS_UNDEFINED. Since we are using a PROGRESS_BAR, it is causing
to show an extra "[100%]" at the end of the diagnose process.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-16 12:54:45 -07:00
Castulo Martinez 53878d8317 API: output for [3rd-party] diagnose
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd diagnose
- swupd 3rd-party diagnose

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-15 16:15:28 -07:00
Castulo Martinez bc58b8bb48 API: output for search-file
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd search-file

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-15 15:35:00 -07:00
Castulo Martinez 532d5743ca API: output for [3rd-party] bundle-info
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd bundle-info
- swupd 3rd-party bundle-info

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-15 08:47:57 -07:00
Castulo Martinez b686c07719 API: output for [3rd-party] bundle-list
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd bundle-list
- swupd 3rd-party bundle-list

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-14 08:55:59 -07:00
Castulo Martinez 7c5c6417d0 Testlib: fix bug regenerating hashes in MoM
When a MoM contains an experimental bundle and the hashes in the MoM are
regenerated, the experimental bundles are being skipped. This commit
fixes that issue.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-13 15:29:46 -07:00
Castulo Martinez e77c270ad8 Show status for all bundles with --status
When listing bundles using "swupd bundle-list --status" we were
distinguishing bundles that were explicitly installed, by marking them
as such and since bundle-list shows only bundles tha are installed, bundles
that were not marked as explicitelly installed were assumed to be
just installed.

When we use "bundle-list --all --status" (which shows installed and
uninstalled bundles), we were marking files as "installed", "explicitly
installed" and bundles without any of these distinctions were assumed to
be not installed. This could cause confusion.

This PR changes the "bundle-list --status" so we always label bundles
as either "implicitly installed" or "installed" (even though it couls
sound a little redundant) so it is consistent with the way they are
labeled during "bundle-list --all --status".

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-13 10:17:24 -07:00
Castulo Martinez 14ba906dd1 Testlib: including os-core in test bundles
When creating test bundles, we are not including os-core in them by
default. This is how it works in production so we should do it so it
resembles the real production environment more accurately.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-13 10:16:17 -07:00
Castulo Martinez faf2d994fb API: output for [3rd-party] bundle-add
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd bundle-add
- swupd 3rd-party bundle-add

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-10 16:44:34 -07:00
Castulo Martinez addd14013b Testlib: fix help menu from function
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-10 16:01:11 -07:00
Castulo Martinez 2fb27c3b5f API: output for [3rd-party] bundle-remove
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd bundle-remove
- swupd 3rd-party bundle-remove

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-10 15:21:59 -07:00
Castulo Martinez d677c42fce 3rd-party: Regenerate wrapper on template change
When the template used for creating the wrapper scripts changes, all
exported binaries should have the scripts regenerated during updates
regardless of if the binary changed.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-10 11:08:16 -07:00
Castulo Martinez 8d6f2f815e Testlib: enable scripts template in the test repos
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-10 11:08:16 -07:00
Castulo Martinez 830aa75895 Testlib: support update_bundle --header-only REPO
The update_bundle() function of testlib has many different options to
create updates for test bundles, all of those supported the creation of
the update in a 3rd-party repository except for the --header-only
option. This commit adds that support do --header-nly flag can also be
used for 3rd-party repos.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-10 11:08:16 -07:00
Castulo Martinez d94920a7d0 API: output for [3rd-party] update
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd update
- swupd 3rd-party update

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-10 10:15:27 -07:00
Castulo Martinez d22bdeb5c4 API: output for [3rd-party] check-update
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:
- swupd check-update
- swupd 3rd-party check-update

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-09 09:56:17 -07:00
Castulo Martinez f3bb9765da API: output for autoupdate
This commit provides a minimal output to be displayed when the --quiet
flag is used for this command:
- swupd autoupdate

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-08 15:47:31 -07:00
Castulo Martinez b62aae3c8c API: output for [3rd-party] info
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:
- swupd info
- swupd 3rd-party info

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-08 15:02:40 -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
Castulo Martinez 3a5cdad882 Test: Adding test cases to cover file type changes
Adding test scenarions fo file type changes:
 - from file -> symlink
 - from file -> recursive symlink
 - from directory -> symlink
 - from symlink -> file
 - from symlink -> directory
 - from file -> directory
 - from directory -> file

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-06 14:44:15 -07:00
Otavio Pontes f6ae8675ff Revert "Test: Adding test cases to cover file type changes"
This reverts commit 2989f8a7f5.
2020-04-06 10:24:48 -07:00
Castulo Martinez 8d15b4dc56 Testlib: do not print the result of openssl
When generating the certificate for tests, openssl is printing messages
to the terminal, we are already selecting what to print by using the
debug_msg() function, so these unwanted messages shouldnot be printed.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-03 08:09:04 -07:00
Otavio Pontes 956822ad78 test: Repo add certificate test was not removing installed files in the system
We need to install/uninstall on test_setup, not global_setup because env
variables are not preserved between tests

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 10:35:54 -07:00
Otavio Pontes 79d0c712aa testlib: Generate swupd certificates for each test to be execute
Instead of requiring an external script (.prereq) to generate the certificates
we can regenerate them before running each test.

Also removes completly the .prereq script

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 10:35:54 -07:00
Castulo Martinez 2989f8a7f5 Test: Adding test cases to cover file type changes
Adding test scenarions fo file type changes:
 - from file -> symlink
 - from file -> recursive symlink
 - from directory -> symlink
 - from symlink -> file
 - from symlink -> directory
 - from file -> directory
 - from directory -> file

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-02 10:11:10 -07:00
Castulo Martinez 238e7d8fe4 Testlib: keep the current status on type change
When updating a bundle using testlib, if the file is updated, and the
update includes a file type change, testlib was updating the manifest
with the correct type but was overwriting the other status flags, so if
a file was marked as 'x' (exported) before, that flag was being removed.

This commit fixes the issue by only updating the flag that relates to
the file type.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-02 08:00:30 -07:00
Castulo Martinez c40b7b094b 3rd-party: repair regenerates scripts of binaries
During a 3rd-party repair, the wrapper scripts of all binaries verified
should be regenerated regardless of if the binary was repaired or not.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 14:37:50 -07:00
Castulo Martinez 20912f8a95 3rd-party: updated binaries need new scripts
When updating a 3rd-party bundle, if any of its binaries is modified,
or the binary is new swupd needs to recreate the wrapper script.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 14:37:50 -07:00
Castulo Martinez 5ab3b8b9e9 Testlib: add function to print the test target fs
When running tests sometimes is useful to see how the filesystem of the
test target system looks like before and after a test. This commit adds
a function to show that chroot fs in a tree view, and it calls that
function in the setup and teardown of tests if DEBUG_TESTS is set.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 13:28:20 -07:00
Castulo Martinez 6f86afbfa3 Testlib: Func to update a bundle based on content
This commit provides a function that can be used to generate update
content based on the content from a directory specified by the user.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 13:28:20 -07:00
Castulo Martinez 57d544384b Testlib: Functions to get entries from manifest
This commit adds a function that retrieve the matching entry from a
manifest or all entries if no key is provided.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 13:28:20 -07:00
Castulo Martinez 9e3dd33247 Testlib: function to create a bundle from content
This commit adds a function to create a bundle based on the content form
a directory specified by the user.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 13:28:20 -07:00
Castulo Martinez a47d8bfa17 Testlib: small corrections in the library
This commit has a few small corrections in testlib:
 - it removes some code that was used for iterative manifests
 - it correct some help menus
 - favors the use of debug_msg over an if statement for filtering
   messages
 - do not follow links in the function that creates tars from
   fullfiles

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 13:28:20 -07:00
Castulo Martinez a55c0cdb2e Testlib: don't follow links adding to manifest
When a test is adding a symlink to a manifest, the file the link is
pointing to is also added to the manifest. This commit prevents the file
pointed by the link to be added, if the user wants to add this file they
can do it explicitely.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 13:28:20 -07:00
Castulo Martinez 8ed40ee2ce Testlib: support file type changes
This commit adds support for file type changes when using bundle_update,
so the correct type is added to the manifest.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 13:28:20 -07:00
Otavio Pontes 54fcaad51e signature: Accept expired signatures for latest file
It is considered safe to accept expired signatures to validate the latest
file because we are always checking again the signature of the MoM file.

Adding tests to validate that:
 - Expired signatures for latest file works
 - Expired signatures for MoM fails even when latest signature is correct

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-01 08:38:15 -07:00
Otavio Pontes 7a338baeb9 tests: Add extra tests to signature validation
- Check if custom certificate is working when valid
 - Check if we are having errors on expired certificate

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-01 08:38:15 -07:00
Otavio Pontes 2fe40faf10 test: Group tests that can be run only on in CI
2 groups were created:
 - slow: Tests that are very slow because of sleeps, so we can run them all
   in parallel
 - system: Tests that make change to the system, so they can cause problems
   when running in parallel, so we run them in series.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-01 08:38:15 -07:00
Otavio Pontes d6ff0586ef 3rd-party: Add 3rd-party share directories to XDG dirs
When creating a wrapper for 3rd-party binaries, append relative
/usr/share and /usr/local/share to XDG_DATA_DIRS variable and /etc
to XDG_CONF_DIRS.

Fix #1411

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-31 14:41:11 -07:00
Castulo Martinez da0ef3e05e Remove extra slash from paths
This commit removes the extra slash '/' from the path from:
- the update_boot function
- the verifytime script

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-03-30 13:39:04 -07:00
Otavio Pontes 450cbe970c tests: Fix shellcheck-all reported problem
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-27 12:53:11 -07:00
Otavio Pontes 3412dd7c6b delta: Don't retry to use manifest deltas
When a manifest delta was incorrect, the full manifest was used. But in the
case of a correct delta that produces an invalid manifest, swupd was never
trying to download the full manifest.

Changing code to try to use deltas only once. On first error, always retry
downloading the full manifest.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-26 18:57:21 -07:00
Castulo Martinez b7c1119f69 Tests: Fix path with extra "/" in tests
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-03-25 13:31:25 -07:00
Castulo Martinez 5ab4f32545 3rd-party: add force option to "3rd-party add"
When swupd is adding a 3rd-party repo and it finds a non empty directory
that matches the repo's name in the content path it warns the user and
aborts. This may have been caused by a corrupt repo.

This commit adds a --force flag to allow users to instruct swupd to
remove the existing directory and its conent and continue adding the
3rd-party repo.

Closes #1388

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-03-25 09:11:23 -07:00
Castulo Martinez c43d612894 Testlib: Fixing the absolute path of a mirror test
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-03-24 11:48:43 -07:00
Otavio Pontes 8300140fbc nosigcheck: Rephrase warning when --nosigcheck* is used
Also don't print duplicated messages anymore

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-23 14:51:58 -07:00