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

Commit

Permalink
Rename various aktualizr-repo abbreviations.
Browse files Browse the repository at this point in the history
"up_gen" was the best I could do to replace "akrepo" and "akt_repo".

Signed-off-by: Patrick Vacek <[email protected]>
  • Loading branch information
pattivacek committed Aug 2, 2019
1 parent 5404fe7 commit 09b8868
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 110 deletions.
12 changes: 6 additions & 6 deletions src/aktualizr_lite/test_lite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e

build_dir=$(pwd)
aklite=$1
akrepo_bin=$2
up_gen_bin=$2
tests_dir=$3
#valgrind=$4
valgrind=""
Expand All @@ -20,8 +20,8 @@ cleanup() {
}
trap cleanup EXIT

akrepo() {
$akrepo_bin --repotype image --path "$dest_dir" "$@"
up_gen() {
$up_gen_bin --repotype image --path "$dest_dir" "$@"
}

add_target() {
Expand All @@ -39,15 +39,15 @@ add_target() {
"targetFormat": "OSTREE"
}
EOF
akrepo --command image \
up_gen --command image \
--targetname $name --targetsha256 $sha --targetlength 0 \
--hwid hwid-for-test --targetcustom $custom_json
}

akrepo --command generate --expires 2021-07-04T16:33:27Z
up_gen --command generate --expires 2021-07-04T16:33:27Z
add_target foo1
add_target foo2
akrepo --command signtargets
up_gen --command signtargets

pushd $dest_dir
python3 -m http.server 0&
Expand Down
10 changes: 5 additions & 5 deletions src/libaktualizr/package_manager/dockerapp_test_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ AKTUALIZR_UPTANE_GENERATOR="$1"
DEST_DIR="$2"
PORT="$3"

akrepo() {
up_gen() {
"$AKTUALIZR_UPTANE_GENERATOR" --path "$DEST_DIR" "$@"
}

Expand All @@ -22,10 +22,10 @@ trap 'rm -rf "$IMAGES"' exit
DOCKER_APP="$IMAGES/foo.dockerapp"
echo "fake contents of a docker app" > "$DOCKER_APP"

akrepo --command generate --expires 2021-07-04T16:33:27Z
akrepo --command image --filename "$DOCKER_APP" --targetname foo.dockerapp --hwid primary_hw
akrepo --command addtarget --hwid primary_hw --serial CA:FE:A6:D2:84:9D --targetname foo.dockerapp
akrepo --command signtargets
up_gen --command generate --expires 2021-07-04T16:33:27Z
up_gen --command image --filename "$DOCKER_APP" --targetname foo.dockerapp --hwid primary_hw
up_gen --command addtarget --hwid primary_hw --serial CA:FE:A6:D2:84:9D --targetname foo.dockerapp
up_gen --command signtargets

cd $DEST_DIR
echo "Target.json is: "
Expand Down
6 changes: 3 additions & 3 deletions src/libaktualizr/package_manager/dockerappmanager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
static std::string repo_server = "http://127.0.0.1:";
static std::string treehub_server = "http://127.0.0.1:";
static boost::filesystem::path test_sysroot;
static boost::filesystem::path akrepo;
static boost::filesystem::path up_gen;

static std::shared_ptr<SotaUptaneClient> newTestClient(Config& config_in, std::shared_ptr<INvStorage> storage_in,
std::shared_ptr<HttpInterface> http_client_in,
Expand All @@ -35,7 +35,7 @@ static void progress_cb(const Uptane::Target& target, const std::string& descrip
static std::unique_ptr<boost::process::child> create_repo(const boost::filesystem::path& repo_path) {
std::string port = TestUtils::getFreePort();
repo_server += port;
auto p = std_::make_unique<boost::process::child>("src/libaktualizr/package_manager/dockerapp_test_repo.sh", akrepo,
auto p = std_::make_unique<boost::process::child>("src/libaktualizr/package_manager/dockerapp_test_repo.sh", up_gen,
repo_path, port);
TestUtils::waitForServer(repo_server + "/");
return p;
Expand Down Expand Up @@ -111,7 +111,7 @@ int main(int argc, char** argv) {
<< " requires the path to an OSTree sysroot and aktualizr-uptane-generator as an input argument.\n";
return EXIT_FAILURE;
}
akrepo = argv[2];
up_gen = argv[2];

std::string port = TestUtils::getFreePort();
treehub_server += port;
Expand Down
16 changes: 8 additions & 8 deletions src/libaktualizr/primary/aktualizr_fullostree_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ int main(int argc, char **argv) {
boost::trim_if(new_rev, boost::is_any_of(" \t\r\n"));
LOG_INFO << "DEST: " << new_rev;

Process akt_repo(aktualizr_uptane_generator_path.string());
akt_repo.run({"generate", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
akt_repo.run({"image", "--path", meta_dir.PathString(), "--targetname", "update_1.0", "--targetsha256", new_rev,
"--targetlength", "0", "--targetformat", "OSTREE", "--hwid", "primary_hw"});
akt_repo.run({"addtarget", "--path", meta_dir.PathString(), "--targetname", "update_1.0", "--hwid", "primary_hw",
"--serial", "CA:FE:A6:D2:84:9D"});
akt_repo.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
LOG_INFO << akt_repo.lastStdOut();
Process up_gen(aktualizr_uptane_generator_path.string());
up_gen.run({"generate", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
up_gen.run({"image", "--path", meta_dir.PathString(), "--targetname", "update_1.0", "--targetsha256", new_rev,
"--targetlength", "0", "--targetformat", "OSTREE", "--hwid", "primary_hw"});
up_gen.run({"addtarget", "--path", meta_dir.PathString(), "--targetname", "update_1.0", "--hwid", "primary_hw",
"--serial", "CA:FE:A6:D2:84:9D"});
up_gen.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
LOG_INFO << up_gen.lastStdOut();
// Work around inconsistent directory naming.
Utils::copyDir(meta_dir.Path() / "repo/image", meta_dir.Path() / "repo/repo");

Expand Down
28 changes: 14 additions & 14 deletions src/libaktualizr/primary/custom_url_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ TEST(Aktualizr, ImagesCustomUrl) {
Config conf = UptaneTestCommon::makeTestConfig(temp_dir, http->tls_server);
logger_set_threshold(boost::log::trivial::trace);

Process akt_repo(aktualizr_uptane_generator_path.string());
akt_repo.run({"generate", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
akt_repo.run({"image", "--path", meta_dir.PathString(), "--filename", "tests/test_data/firmware.txt", "--targetname",
"firmware.txt", "--hwid", "primary_hw", "--url", "test-url"});
akt_repo.run({"addtarget", "--path", meta_dir.PathString(), "--targetname", "firmware.txt", "--hwid", "primary_hw",
"--serial", "CA:FE:A6:D2:84:9D"});
akt_repo.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
Process up_gen(aktualizr_uptane_generator_path.string());
up_gen.run({"generate", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
up_gen.run({"image", "--path", meta_dir.PathString(), "--filename", "tests/test_data/firmware.txt", "--targetname",
"firmware.txt", "--hwid", "primary_hw", "--url", "test-url"});
up_gen.run({"addtarget", "--path", meta_dir.PathString(), "--targetname", "firmware.txt", "--hwid", "primary_hw",
"--serial", "CA:FE:A6:D2:84:9D"});
up_gen.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
// Work around inconsistent directory naming.
Utils::copyDir(meta_dir.Path() / "repo/image", meta_dir.Path() / "repo/repo");

Expand All @@ -71,13 +71,13 @@ TEST(Aktualizr, BothCustomUrl) {
Config conf = UptaneTestCommon::makeTestConfig(temp_dir, http->tls_server);
logger_set_threshold(boost::log::trivial::trace);

Process akt_repo(aktualizr_uptane_generator_path.string());
akt_repo.run({"generate", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
akt_repo.run({"image", "--path", meta_dir.PathString(), "--filename", "tests/test_data/firmware.txt", "--targetname",
"firmware.txt", "--hwid", "primary_hw", "--url", "test-url2"});
akt_repo.run({"addtarget", "--path", meta_dir.PathString(), "--targetname", "firmware.txt", "--hwid", "primary_hw",
"--serial", "CA:FE:A6:D2:84:9D", "--url", "test-url3"});
akt_repo.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
Process up_gen(aktualizr_uptane_generator_path.string());
up_gen.run({"generate", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
up_gen.run({"image", "--path", meta_dir.PathString(), "--filename", "tests/test_data/firmware.txt", "--targetname",
"firmware.txt", "--hwid", "primary_hw", "--url", "test-url2"});
up_gen.run({"addtarget", "--path", meta_dir.PathString(), "--targetname", "firmware.txt", "--hwid", "primary_hw",
"--serial", "CA:FE:A6:D2:84:9D", "--url", "test-url3"});
up_gen.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
// Work around inconsistent directory naming.
Utils::copyDir(meta_dir.Path() / "repo/image", meta_dir.Path() / "repo/repo");

Expand Down
36 changes: 18 additions & 18 deletions src/libaktualizr/primary/empty_targets_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ TEST(Aktualizr, EmptyTargets) {
conf.pacman.fake_need_reboot = true;
logger_set_threshold(boost::log::trivial::trace);

Process akt_repo(aktualizr_uptane_generator_path.string());
akt_repo.run({"generate", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
akt_repo.run({"image", "--path", meta_dir.PathString(), "--filename", "tests/test_data/firmware.txt", "--targetname",
"firmware.txt", "--hwid", "primary_hw"});
akt_repo.run({"addtarget", "--path", meta_dir.PathString(), "--targetname", "firmware.txt", "--hwid", "primary_hw",
"--serial", "CA:FE:A6:D2:84:9D"});
akt_repo.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
Process up_gen(aktualizr_uptane_generator_path.string());
up_gen.run({"generate", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
up_gen.run({"image", "--path", meta_dir.PathString(), "--filename", "tests/test_data/firmware.txt", "--targetname",
"firmware.txt", "--hwid", "primary_hw"});
up_gen.run({"addtarget", "--path", meta_dir.PathString(), "--targetname", "firmware.txt", "--hwid", "primary_hw",
"--serial", "CA:FE:A6:D2:84:9D"});
up_gen.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
// Work around inconsistent directory naming.
Utils::copyDir(meta_dir.Path() / "repo/image", meta_dir.Path() / "repo/repo");

Expand All @@ -61,8 +61,8 @@ TEST(Aktualizr, EmptyTargets) {
result::Download download_result = aktualizr.Download(update_result.updates).get();
EXPECT_EQ(download_result.status, result::DownloadStatus::kSuccess);

akt_repo.run({"emptytargets", "--path", meta_dir.PathString()});
akt_repo.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
up_gen.run({"emptytargets", "--path", meta_dir.PathString()});
up_gen.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});

result::UpdateCheck update_result2 = aktualizr.CheckUpdates().get();
EXPECT_EQ(update_result2.status, result::UpdateStatus::kUpdatesAvailable);
Expand Down Expand Up @@ -105,13 +105,13 @@ TEST(Aktualizr, EmptyTargetsAfterInstall) {
Config conf = UptaneTestCommon::makeTestConfig(temp_dir, http->tls_server);
logger_set_threshold(boost::log::trivial::trace);

Process akt_repo(aktualizr_uptane_generator_path.string());
akt_repo.run({"generate", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
akt_repo.run({"image", "--path", meta_dir.PathString(), "--filename", "tests/test_data/firmware.txt", "--targetname",
"firmware.txt", "--hwid", "primary_hw"});
akt_repo.run({"addtarget", "--path", meta_dir.PathString(), "--targetname", "firmware.txt", "--hwid", "primary_hw",
"--serial", "CA:FE:A6:D2:84:9D"});
akt_repo.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
Process up_gen(aktualizr_uptane_generator_path.string());
up_gen.run({"generate", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
up_gen.run({"image", "--path", meta_dir.PathString(), "--filename", "tests/test_data/firmware.txt", "--targetname",
"firmware.txt", "--hwid", "primary_hw"});
up_gen.run({"addtarget", "--path", meta_dir.PathString(), "--targetname", "firmware.txt", "--hwid", "primary_hw",
"--serial", "CA:FE:A6:D2:84:9D"});
up_gen.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
// Work around inconsistent directory naming.
Utils::copyDir(meta_dir.Path() / "repo/image", meta_dir.Path() / "repo/repo");

Expand All @@ -138,8 +138,8 @@ TEST(Aktualizr, EmptyTargetsAfterInstall) {
}

// Backend reacts to failure: no need to install the target anymore
akt_repo.run({"emptytargets", "--path", meta_dir.PathString()});
akt_repo.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
up_gen.run({"emptytargets", "--path", meta_dir.PathString()});
up_gen.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});

// check that no update is available
{
Expand Down
14 changes: 7 additions & 7 deletions src/libaktualizr/primary/target_mismatch_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ TEST(Aktualizr, HardwareMismatch) {
Config conf = UptaneTestCommon::makeTestConfig(temp_dir, http->tls_server);
logger_set_threshold(boost::log::trivial::trace);

Process akt_repo(aktualizr_uptane_generator_path.string());
akt_repo.run({"generate", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
Process up_gen(aktualizr_uptane_generator_path.string());
up_gen.run({"generate", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
// Note bad hardware ID in the image repo metadata. If we were to use an
// invalid value in the Director, it gets rejected even earlier.
akt_repo.run({"image", "--path", meta_dir.PathString(), "--filename", "tests/test_data/firmware.txt", "--targetname",
"firmware.txt", "--hwid", "hw-mismatch", "--url", "test-url"});
akt_repo.run({"addtarget", "--path", meta_dir.PathString(), "--targetname", "firmware.txt", "--hwid", "primary_hw",
"--serial", "CA:FE:A6:D2:84:9D"});
akt_repo.run({"signtargets", "--path", meta_dir.PathString()});
up_gen.run({"image", "--path", meta_dir.PathString(), "--filename", "tests/test_data/firmware.txt", "--targetname",
"firmware.txt", "--hwid", "hw-mismatch", "--url", "test-url"});
up_gen.run({"addtarget", "--path", meta_dir.PathString(), "--targetname", "firmware.txt", "--hwid", "primary_hw",
"--serial", "CA:FE:A6:D2:84:9D"});
up_gen.run({"signtargets", "--path", meta_dir.PathString()});
// Work around inconsistent directory naming.
Utils::copyDir(meta_dir.Path() / "repo/image", meta_dir.Path() / "repo/repo");

Expand Down
18 changes: 9 additions & 9 deletions src/libaktualizr/uptane/director_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace Uptane {
TEST(Director, EmptyTargets) {
TemporaryDirectory meta_dir;

Process akt_repo(aktualizr_uptane_generator_path.string());
akt_repo.run({"generate", "--path", meta_dir.PathString()});
Process up_gen(aktualizr_uptane_generator_path.string());
up_gen.run({"generate", "--path", meta_dir.PathString()});

DirectorRepository director;
EXPECT_TRUE(director.initRoot(Utils::readFile(meta_dir.Path() / "repo/director/root.json")));
Expand All @@ -25,19 +25,19 @@ TEST(Director, EmptyTargets) {
EXPECT_TRUE(director.targets.targets.empty());
EXPECT_TRUE(director.latest_targets.targets.empty());

akt_repo.run({"image", "--path", meta_dir.PathString(), "--filename", "tests/test_data/firmware.txt", "--targetname",
"firmware.txt", "--hwid", "primary_hw"});
akt_repo.run({"addtarget", "--path", meta_dir.PathString(), "--targetname", "firmware.txt", "--hwid", "primary_hw",
"--serial", "CA:FE:A6:D2:84:9D"});
akt_repo.run({"signtargets", "--path", meta_dir.PathString()});
up_gen.run({"image", "--path", meta_dir.PathString(), "--filename", "tests/test_data/firmware.txt", "--targetname",
"firmware.txt", "--hwid", "primary_hw"});
up_gen.run({"addtarget", "--path", meta_dir.PathString(), "--targetname", "firmware.txt", "--hwid", "primary_hw",
"--serial", "CA:FE:A6:D2:84:9D"});
up_gen.run({"signtargets", "--path", meta_dir.PathString()});

EXPECT_TRUE(director.verifyTargets(Utils::readFile(meta_dir.Path() / "repo/director/targets.json")));
EXPECT_EQ(director.targets.targets.size(), 1);
EXPECT_EQ(director.targets.targets[0].filename(), "firmware.txt");
EXPECT_EQ(director.targets.targets.size(), director.latest_targets.targets.size());

akt_repo.run({"emptytargets", "--path", meta_dir.PathString()});
akt_repo.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});
up_gen.run({"emptytargets", "--path", meta_dir.PathString()});
up_gen.run({"signtargets", "--path", meta_dir.PathString(), "--correlationid", "abc123"});

EXPECT_TRUE(director.verifyTargets(Utils::readFile(meta_dir.Path() / "repo/director/targets.json")));
EXPECT_EQ(director.targets.targets.size(), 1);
Expand Down
6 changes: 3 additions & 3 deletions tests/test_io_failure.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@


@contextlib.contextmanager
def uptane_repo(akt_repo):
def uptane_repo(up_gen):
with tempfile.TemporaryDirectory() as repo_path:
arepo = [akt_repo, '--keytype', 'ed25519']
arepo = [up_gen, '--keytype', 'ed25519']
run([*arepo, 'generate', '--path', repo_path])
fw_path = path.join(repo_path, 'images/firmware.txt')
os.makedirs(path.join(repo_path, 'images'))
Expand Down Expand Up @@ -91,7 +91,7 @@ def main():

srcdir = path.abspath(args.akt_srcdir) if args.akt_srcdir is not None else os.getcwd()

with uptane_repo(args.akt_repo) as repo_dir, \
with uptane_repo(args.up_gen) as repo_dir, \
FakeTestServerBackground(repo_dir, srcdir=srcdir) as uptane_server, \
multiprocessing.Pool(args.jobs) as pool:

Expand Down
18 changes: 9 additions & 9 deletions tests/uptane_repo_generation/delegation_basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [ "$#" -eq 3 ]; then
fi


akrepo() {
up_gen() {
"$AKTUALIZR_UPTANE_GENERATOR" --path "$DEST_DIR" "$@"
}

Expand All @@ -28,13 +28,13 @@ echo "primary" > "$PRIMARY_FIRMWARE"
SECONDARY_FIRMWARE="$IMAGES/secondary.txt"
echo "secondary" > "$SECONDARY_FIRMWARE"
if [[ "$REVOKE" = "revoke" ]]; then
akrepo --command revokedelegation --dname new-role
up_gen --command revokedelegation --dname new-role
else
akrepo --command generate --expires 2021-07-04T16:33:27Z
akrepo --command adddelegation --dname new-role --dpattern "abc/*" --keytype ed25519
akrepo --command image --filename "$PRIMARY_FIRMWARE" --targetname primary.txt --hwid primary_hw
akrepo --command image --filename "$SECONDARY_FIRMWARE" --targetname "abc/secondary.txt" --dname new-role --hwid secondary_hw
akrepo --command addtarget --hwid primary_hw --serial CA:FE:A6:D2:84:9D --targetname primary.txt
akrepo --command addtarget --hwid secondary_hw --serial secondary_ecu_serial --targetname "abc/secondary.txt"
akrepo --command signtargets
up_gen --command generate --expires 2021-07-04T16:33:27Z
up_gen --command adddelegation --dname new-role --dpattern "abc/*" --keytype ed25519
up_gen --command image --filename "$PRIMARY_FIRMWARE" --targetname primary.txt --hwid primary_hw
up_gen --command image --filename "$SECONDARY_FIRMWARE" --targetname "abc/secondary.txt" --dname new-role --hwid secondary_hw
up_gen --command addtarget --hwid primary_hw --serial CA:FE:A6:D2:84:9D --targetname primary.txt
up_gen --command addtarget --hwid secondary_hw --serial secondary_ecu_serial --targetname "abc/secondary.txt"
up_gen --command signtargets
fi
Loading

0 comments on commit 09b8868

Please sign in to comment.