Skip to content
This repository was archived by the owner on May 21, 2024. It is now read-only.

Feat/c api updates #1458

Merged
merged 3 commits into from
Nov 25, 2019
Merged

Feat/c api updates #1458

merged 3 commits into from
Nov 25, 2019

Conversation

mchekhovoi
Copy link

No description provided.

@lbonn
Copy link
Contributor

lbonn commented Nov 22, 2019

Can be rebased on master to fix the failure in check_not_expired_targets

Signed-off-by: Chekhovoi, Mykola <ext-mykola.chekhovoi@here.com>
@codecov-io
Copy link

codecov-io commented Nov 22, 2019

Codecov Report

Merging #1458 into master will increase coverage by 0.04%.
The diff coverage is 90%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1458      +/-   ##
=========================================
+ Coverage   80.36%   80.4%   +0.04%     
=========================================
  Files         183     182       -1     
  Lines       11047   11026      -21     
=========================================
- Hits         8878    8866      -12     
+ Misses       2169    2160       -9
Impacted Files Coverage Δ
src/libaktualizr-c/test/api-test.c 68.25% <100%> (-0.25%) ⬇️
...baktualizr-c/test/api-test-utils/api-test-utils.cc 95.65% <87.5%> (-4.35%) ⬇️
src/uptane_generator/main.cc 81.03% <0%> (-1.73%) ⬇️
src/libaktualizr/storage/sqlstorage_base.cc 78.37% <0%> (-0.68%) ⬇️
src/aktualizr_info/main.cc 91.16% <0%> (+0.46%) ⬆️
src/libaktualizr/storage/sqlstorage.cc 78.13% <0%> (+1.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5b09647...d323579. Read the comment docs.

Copy link
Collaborator

@pattivacek pattivacek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a couple nits. I like reusing the repo generation script!

@@ -32,11 +33,18 @@ Config *Get_test_config(const char *storagePath) {
config->provision.server = serverAddress;
config->provision.provision_path = "tests/test_data/cred.zip";

config->storage.path = storagePath;
temp_dir = new TemporaryDirectory;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a unique_ptr here instead of a raw new and delete?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no std::make_unique in C++11.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but we've filled in the gap:

// this is reference implementation of make_unique which is not yet included to C++11

uptane_gen --command addtarget --hwid primary_hw --serial CA:FE:A6:D2:84:9D --targetname primary.txt

if [ "$ADD_DEFAULT_SECONDARY" = true ]
then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big deal, but we usually prefer the style if [ ]; then as you did above.

@pattivacek
Copy link
Collaborator

I thought it looked fine but something went wrong when I tried to run this through ptest in CI: https://main.gitlab.in.here.com/olp/edge/ota/connect/client/meta-updater/-/jobs/863441

…oved as unnecessary.

Signed-off-by: Chekhovoi, Mykola <ext-mykola.chekhovoi@here.com>
SET(REPO_PATH ${PROJECT_BINARY_DIR}/uptane_repos/c-api-test-repo)

if(CMAKE_CROSSCOMPILING)
find_program(UPTANE_GENERATOR NAMES uptane-generator)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this CMAKE_CROSSCOMPILING clause. We ought to be able to do the same things we do in src/libaktualizr/primary/CMakeLists.txt and tests/uptane_repo_generation/CMakeLists.txt to create the repos and then make sure the test depends on that task and can find the paths.

@pattivacek
Copy link
Collaborator

It probably makes sense for you to run the ptests in CI directly. Basically you need to create a branch in meta-updater that bumps the aktualizr version (you can reuse mine; https://main.gitlab.in.here.com/olp/edge/ota/connect/client/meta-updater/tree/fix/ptest-c-api) and then run a pipeline on that branch with OE_PTEST set to 1. (You can also set OE_RPI to 0 to save some time.)

@mchekhovoi
Copy link
Author

https://main.gitlab.in.here.com/olp/edge/ota/connect/client/meta-updater/-/jobs/866481 - I suppose t_c_api_test is passed now (using "if(CMAKE_CROSSCOMPILING)").

Signed-off-by: Chekhovoi, Mykola <ext-mykola.chekhovoi@here.com>
@pattivacek pattivacek merged commit 79d5a4f into master Nov 25, 2019
@pattivacek pattivacek deleted the feat/c-api-updates branch November 25, 2019 15:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants