53 Commits
Author SHA1 Message Date
Otavio Pontes 5f99c841f5 packs: Download packs in parallel
Use download.c parallel download api to download packs in parallel,
the same way we do for fullfiles.

Some changes were necessary in update/slow-server test. As we are using the
parallel download api to download packs the resume  strategy is now the same
described in b07285. Because of that download resume is only enables when the
download is interrupted in the first try. So we force a download fail and a
download retry in server.py to check if swupd is trying to resume the download.
Because of this change the update/slow-server test is performing 2 retries
(first downloaded is interrupted to force a resume and the second is interrupted
because the slow-server don't support download resumes) and this adds a 30 seconds
delay to the test execution. This delay isn't going to slow down the test execution
considerably, but the ideal is in the future to support running tests with 0s
timeouts. For this reason update/slow-server is being skip when not running in
travis ci.
2018-08-21 17:04:43 -07:00
Otavio Pontes 07ae1ac8c5 download: Don't warn about files missing in packs
It's inconsistent to list just the first file missing in a pack. As
There's already a warning saying home many files are missing in
packs, remove this print.
2018-07-13 16:15:41 -07:00
Otavio Pontes 368c504a4d test: Use different ports for tests to avoid colision
When running all tests at the same time using make -j check,
update/slow-server and check-update/slow server were trying to start
the slow server at the same port.
2018-07-04 07:03:53 -07:00
Otavio Pontes 573427039a test: Check if the download resume check is working
It would be great to have in the future a server implemetation with support
to resume downloads to check if the feature is really working.
2018-06-14 13:04:31 -07:00
Otavio Pontes 9648035803 Update: Use consolidated version of fullfiles download
Use download_fullfiles() instead of reimplementing it on
full_download_loop().

Tests:
 - Test skip-verified-fullfiles was alterered because in the current
implementation start_full_download() won't be called when there's no
extra file to download.
2018-06-08 10:43:09 -07:00
Otavio Pontes 10064b823f Update: Change log order to have a clearer output
Message informing that the system was successfully updated should be
the last message. Having a message that looks like an error as the
last message in an update can be confusing for users.
2018-06-05 11:29:45 -07:00
Matthew Johnson e68a8a6db6 Update tests to remove version download string
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-04-30 14:54:23 -07:00
Caio Marcelo de Oliveira Filho 8d7a3185c4 Apply all possible deltas from the pack, not only renames
Consider all deltas from a pack instead of only those who are involved
in a rename. This will allow the server to make better packs
regardless of the from/to version, with the possibility of a delta to
a file that was not necessarily marked with the rename flag.

This makes deltapeer member of file unused, so it was removed. The
peer member continues to be used for its original role: mapping the
same files (same filename) between two manifests, usually the state of
the local system and some new version to be installed.

The test case added is like test/functional/update/rename, but without
the rename flags present. Since in that test there are some fullfiles
missing, it will only pass if swupd-client applies the deltas in the
pack.
2018-04-13 19:07:31 -07:00
Icarus Sparry e52ba1e7df Change contentsize in Manifest.MoM to 0
The previous value - 13,805,671,819 is bogus, and we want to be able
to test if the value is reasonable.

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2018-03-19 14:42:22 -07:00
Matthew Johnson 7483535256 Handle bundle-add hash failures
Fixes #252
Fixes #370
Fixes #371
When failing to add bundle with a file with the wrong hash remove the
file and fall back to the verify_fix_path. Improve warnings so they
don't look like errors until they are actually errors.

Add tests so we don't regress in this regard.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-01-29 08:54:03 -08:00
Patrick McCarty 90a8e6a366 Fix tests that are lacking chown reverts
Most of the functional tests properly reverted the chown operations in
teardown(), but three of them were missing the reverts.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2018-01-04 07:26:28 -08:00
Matthew Johnson 9d06cbf9b8 Add functional test for bad hash in state directory
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-11-03 11:45:39 -07:00
Matthew Johnson 91d067b7c9 Add tests for --no-scripts flag
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-11-02 09:07:39 -07:00
Matthew Johnson c79297886b Fix re-exec capabilities over format bumps
Instead of relying on swupd-server to put the post-update action in the
correct manifest and in the correct format, do the format change
detection on the client.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-10-19 09:51:08 -07:00
Matthew Johnson d98353c376 Add .gitignore to rename test target-dir
The target-dir is wiped every run, so putting the .gitignore in the
target-dir directory doesn't work.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-10-16 14:16:31 -07:00
Matthew Johnson 5aeee1bf86 Add functional tests for ghosted renames and deletes
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-10-16 14:16:31 -07:00
Patrick McCarty 8708dc8722 test: add lines-checked for update/rename test
Since I changed check_lines() to propogate the matcher.awk exit status,
this test failed due to a missing 'lines-checked' file. Add the file to
fix that issue.

Also, remove the -x and -v options to the shell invocation, because more
lines of output are produced and that should not be checked.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-10-12 10:40:37 -07:00
Icarus Sparry 58e2a5c527 Test for rename
This test renames foo to bar with no changes to contents, and baz to
bat with minimal changes.

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2017-10-02 13:13:27 -07:00
Arzhan Kinzhalin feadea96b6 Implement fallback CApath support.
A colon-separated list of alternative CApath options can be passed to
swupd-client at the configuration time using --with-fallback-capaths
option.

In runtime, fallback CApath support is implemented as part of the
connectivity check. The implementation will try the default (built into
curl) and then will iterate through the list in the order they were
specified. It is done only once on the first call.

The code is reorganized to keep the connectivity check inside curl
wrapper:

* Deleted check_network implementation from version.c
* Removed have_network global (globals.c)
* Scoped swupd_curl_test_resume to curl.c
* Change use of check_network to swupd_curl_check_network

Also:

* Fixed an issue where SSL was only enabled if a URL was matching the
  content URL
2017-10-02 11:30:48 -07:00
Matthew Johnson d0e18b8a69 Add functional tests for --no-boot-update flag
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-09-15 10:44:32 -07:00
Matthew Johnson d274f3aede Add "Applying update" print as a progress header
Since this step can take a while print a header to give an indication of
what the progress percentage is tracking. Update functional tests to
include new output.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-08-17 15:37:15 -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
Matthew Johnson 89af564256 Convert post_update_actions to list-based approach
Instead of allowing only one "actions:" field in the Manifest.MoM, allow
for several and read each into the post_udpate_actions list. This allows
us to add more actions down the road if desired.

Currently the only use for the "actions:" field is to indicate when a
re-update is required. This is handled by checking if the string
"update" is in the post_update_actions list.

Finally, remove the warning to the user to perform the post update
action themselves, as this will be handled by swupd itself. Functional
tests updated to reflect the missing output.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-07-28 23:19:54 -07:00
Matthew Johnson d6636d7814 Add functional test for re-update with bad os-release
Adds a functional test for swupd re-update when the os-release file does
not get updated.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-07-28 23:19:54 -07:00
Matthew Johnson 1d19db4bc1 Add funtional test for swupd re-update
Adds functional test for swupd re-execs over format bumps.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-07-28 23:19:54 -07:00
Tudor Marcu dac74856da Update tests for new messages being printed
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2017-04-19 10:12:51 -07:00
Patrick McCarty bce9fb436f test: remove unused .signed files
These files have never been used by the functional tests, so remove them
from the tree.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-01-31 12:39:09 -08:00
Tudor Marcu a565cd0304 Update tests for mandatory signature verification
With mandatory signature verification being enabled, the tests will have
to generate a certificate and sign their Manifest.MoMs to properly run the
swupd operations.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-12-20 16:13:55 -08:00
Tudor Marcu 5f5c7dcaf2 Remove more unneeded printfs
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -07:00
Tudor Marcu 26658ca8e0 Update tests for new ouput
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-11-04 16:24:50 -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 9affcd210e Updates for functional tests
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-11-02 11:41:00 -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
William Douglas 285c18c54e Add missing update include test
This is a functional test for the fix implemented in #122.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-09-30 15:05:44 -07:00
Patrick McCarty 5cdad496c0 Fix functional tests for breaking changes
To two latest commits introduce breaking changes to the updater, so the
static server content needs to be refreshed.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-08-15 15:22:34 -07:00
Patrick McCarty 3e0fff6a47 Ignore signature verification errors in functional tests
Because signature verification is a feature that we need separate
testing for, and swupd's output may print a verification error (or not)
depending on how swupd was built, add a helper function to remove the
verification error message when swupd is built with verification
enabled. If verification is not enabled, swupd will not print any
message, and the function is a no-op.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-06-27 11:56:01 -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 4b522b352a Skip verified unchanged files in update
Instead of just checking if the versions have changed for a file to be
updated, compare the current file's hash to updated file's expected hash
and only queue files for update that are changed.
2016-06-07 16:06:42 -07:00
Patrick McCarty a5632aba0d Fix tests for compatibility with latest GNU tar
The recent GNU tar release (1.29) is more strict with option parsing in
that positional options must come before the file list to add to the
archive.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-06-07 15:54:32 -07:00
Patrick McCarty b202b87187 Expand test from previous commit to check the error message
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-05-20 12:35:03 -07:00
William Douglas 9f4feee501 Fail instead of staging bad file hashes in update
Check file hashes after successful tar extraction and fail if there is a
hash mismatch during udpate. As part of this change failure handling for
errors in the tar extraction path with a check space warning as a best
guess of error cause.

This change also fixes tests where the hashes were not correct and adds
a test to verify hash matching is verified.
2016-05-17 21:04:17 +00:00
William Douglas a52eeb42cb Move functional tests to use the BATS framework 2016-04-26 22:15:04 +00:00
Patrick McCarty 311050ddd1 Add a functional test for the expected delete/delete consolidation
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-04-12 15:19:15 -07:00
Patrick McCarty 23dd3cc2dd Fix fullfile delta application with path_prefix set
Fullfile deltas were only being applied to the root filesystem, since
the prefix was a compile-time constant string (STAGING_SUBVOL) set to
"/" by default.

Instead, use path_prefix for the prefix so that the deltas can be
applied when specifying --path on the command line. This also enables
writing a functional test for the delta application, added in this
commit.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-04-04 21:50:31 -07:00
William Douglas 7e636c07d1 Fix update when include manifests are not new
Previously include manifests that were not newer than the current
version would be silently ignored even if they had not been previously
installed causing bundles to miss included dependencies.

Fix this by adding a is_tracked field to struct file that is nonzero
when the bundle the file is contained in is marked as tracked via having
a /usr/share/clear/bundles/$name file.

The is_tracked == 0 version of the file will be dropped in the
consolidate_manifest phase if that filename from another bundle has
is_tracked != 0 to avoid downloading and installing an already existing
file.

The is_tracked == 0 version of the file will then be added to the update
list from the consolidated manifest if that file was not previously
installed on the system (in addition to the other cases it would already
have been added to the list for).
2016-04-04 21:24:43 +00:00
Patrick McCarty 5407e70e44 Use formatstaging for functional tests
Since a numeric format now requires a config file, and aligning the
client format with the test format is a maintenance problem, use the
"staging" format for all tests.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-04-04 11:42:25 -07:00
William Douglas 7544162243 Add include support for update
Add support in update to properly support bundles that include other
bundles inside them. This feature is intended to work with bundle
additions by adding included bundles (from bundles already subscribed)
to the subscription list prior to downloading packs and full files.

As part of this change the add_subscriptions function from bundle.c was
modified to handle retrying manifest downloads.
2016-03-22 10:38:57 -07:00
William Douglas 4c7f900a79 Fix bundle manifest
Test bundle was for version 100 but used version 10 content, update
contents for version 100.
2016-03-22 10:38:57 -07:00
William Douglas 7fa16a7e25 Update test for missing os-core bundle on update
os-core should always be in the list of subscribed bundles so fix test
to check if it exists in the subscribed list or not.
2016-03-22 10:38:57 -07:00