-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
197 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
import os | ||
import pytest | ||
|
||
from helper import run | ||
from conftest import have_casync | ||
from conftest import have_desync | ||
|
||
|
||
@pytest.mark.skipif(not have_casync(), reason="Have no casync") | ||
def test_rauc_convert(tmp_path): | ||
out, err, exitcode = run( | ||
'rauc' | ||
' --cert openssl-ca/dev/autobuilder-1.cert.pem' | ||
' --key openssl-ca/dev/private/autobuilder-1.pem' | ||
' --keyring openssl-ca/dev-ca.pem' | ||
f' convert good-bundle.raucb {tmp_path}/casync.raucb') | ||
|
||
assert exitcode == 0 | ||
|
||
assert os.path.exists(f'{tmp_path}/casync.raucb') | ||
|
||
|
||
@pytest.mark.skipif(not have_casync(), reason="Have no casync") | ||
def test_rauc_convert_ignore_image(tmp_path): | ||
out, err, exitcode = run( | ||
'rauc' | ||
' --cert openssl-ca/dev/autobuilder-1.cert.pem' | ||
' --key openssl-ca/dev/private/autobuilder-1.pem' | ||
' --keyring openssl-ca/dev-ca.pem' | ||
' convert' | ||
' --ignore-image appfs' | ||
f' good-bundle.raucb {tmp_path}/casync.raucb') | ||
|
||
assert exitcode == 0 | ||
|
||
assert os.path.exists(f'{tmp_path}/casync.raucb') | ||
|
||
|
||
@pytest.mark.skipif(not have_casync(), reason="Have no casync") | ||
def test_rauc_convert_output_exists(tmp_path): | ||
|
||
open(f'{tmp_path}/casync.raucb', 'a').close() | ||
|
||
out, err, exitcode = run( | ||
'rauc' | ||
' --cert openssl-ca/dev/autobuilder-1.cert.pem' | ||
' --key openssl-ca/dev/private/autobuilder-1.pem' | ||
' --keyring openssl-ca/dev-ca.pem' | ||
f' convert good-bundle.raucb {tmp_path}/casync.raucb') | ||
|
||
assert exitcode == 1 | ||
assert "already exists" in err | ||
|
||
assert os.path.exists(f'{tmp_path}/casync.raucb') | ||
|
||
|
||
@pytest.mark.skipif(not have_casync(), reason="Have no casync") | ||
def test_rauc_convert_error(tmp_path): | ||
|
||
out, err, exitcode = run( | ||
'rauc' | ||
' --cert openssl-ca/rel/release-2018.cert.pem' | ||
' --key openssl-ca/rel/private/release-2018.pem' | ||
' --keyring openssl-ca/rel-ca.pem' | ||
f' convert good-bundle.raucb {tmp_path}/casync.raucb') | ||
|
||
assert exitcode == 1 | ||
|
||
assert not os.path.exists(f'{tmp_path}/casync.raucb') | ||
|
||
|
||
@pytest.mark.skipif(not have_casync(), reason="Have no casync") | ||
def test_rauc_convert_casync_extra_args(tmp_path): | ||
|
||
out, err, exitcode = run( | ||
'rauc' | ||
' --cert openssl-ca/dev/autobuilder-1.cert.pem' | ||
' --key openssl-ca/dev/private/autobuilder-1.pem' | ||
' --keyring openssl-ca/dev-ca.pem' | ||
' convert' | ||
' --casync-args=\"--chunk-size=64000\"' | ||
f' good-bundle.raucb {tmp_path}/casync-extra-args.raucb') | ||
|
||
assert exitcode == 0 | ||
|
||
assert os.path.exists(f'{tmp_path}/casync-extra-args.raucb') | ||
assert os.path.isdir(f'{tmp_path}/casync-extra-args.castr') | ||
|
||
|
||
@pytest.mark.skipif(not have_casync(), reason="Have no casync") | ||
def test_rauc_convert_verity(tmp_path): | ||
|
||
out, err, exitcode = run( | ||
'rauc' | ||
' --cert openssl-ca/dev/autobuilder-1.cert.pem' | ||
' --key openssl-ca/dev/private/autobuilder-1.pem' | ||
f' bundle install-content/ {tmp_path}/tmp-verity.raucb') | ||
assert exitcode == 0 | ||
|
||
out, err, exitcode = run( | ||
'rauc' | ||
' --cert openssl-ca/dev/autobuilder-1.cert.pem' | ||
' --key openssl-ca/dev/private/autobuilder-1.pem' | ||
' --keyring openssl-ca/dev-ca.pem' | ||
' --trust-environment' | ||
f' convert {tmp_path}/tmp-verity.raucb {tmp_path}/casync-verity.raucb') | ||
|
||
assert exitcode == 0 | ||
|
||
assert os.path.exists(f'{tmp_path}/casync-verity.raucb') | ||
assert os.path.isdir(f'{tmp_path}/casync-verity.castr') | ||
|
||
|
||
@pytest.mark.skipif(not have_desync(), reason="Have no desync") | ||
def test_rauc_convert_desync(tmp_path): | ||
|
||
out, err, exitcode = run( | ||
'rauc' | ||
' --cert openssl-ca/dev/autobuilder-1.cert.pem' | ||
' --key openssl-ca/dev/private/autobuilder-1.pem' | ||
' --keyring openssl-ca/dev-ca.pem' | ||
' --conf minimal-desync-test.conf' | ||
f' convert good-bundle.raucb {tmp_path}/desync.raucb') | ||
|
||
assert exitcode == 0 | ||
|
||
assert os.path.exists(f'{tmp_path}/desync.raucb') | ||
assert os.path.isdir(f'{tmp_path}/desync.castr') | ||
|
||
|
||
@pytest.mark.skipif(not have_desync(), reason="Have no desync") | ||
def test_rauc_convert_desync_output_exists(tmp_path): | ||
|
||
open(f'{tmp_path}/desync.raucb', 'a').close() | ||
|
||
out, err, exitcode = run( | ||
'rauc' | ||
' --cert openssl-ca/dev/autobuilder-1.cert.pem' | ||
' --key openssl-ca/dev/private/autobuilder-1.pem' | ||
' --keyring openssl-ca/dev-ca.pem' | ||
' --conf minimal-desync-test.conf' | ||
f' convert good-bundle.raucb {tmp_path}/desync.raucb') | ||
|
||
assert exitcode == 1 | ||
assert "already exists" in err | ||
|
||
assert os.path.exists(f'{tmp_path}/desync.raucb') | ||
|
||
|
||
@pytest.mark.skipif(not have_desync(), reason="Have no desync") | ||
def test_rauc_convert_desync_error(tmp_path): | ||
|
||
out, err, exitcode = run( | ||
'rauc' | ||
' --cert openssl-ca/rel/release-2018.cert.pem' | ||
' --key openssl-ca/rel/private/release-2018.pem' | ||
' --keyring openssl-ca/rel-ca.pem' | ||
' --conf minimal-desync-test.conf' | ||
f' convert good-bundle.raucb {tmp_path}/desync.raucb') | ||
|
||
assert exitcode == 1 | ||
|
||
assert not os.path.exists(f'{tmp_path}/desync.raucb') | ||
|
||
|
||
@pytest.mark.skipif(not have_desync(), reason="Have no desync") | ||
def test_rauc_convert_desync_extra_args(tmp_path): | ||
|
||
out, err, exitcode = run( | ||
'rauc' | ||
' --cert openssl-ca/dev/autobuilder-1.cert.pem' | ||
' --key openssl-ca/dev/private/autobuilder-1.pem' | ||
' --keyring openssl-ca/dev-ca.pem' | ||
' --conf minimal-desync-test.conf' | ||
' convert' | ||
' --casync-args=\"--chunk-size=32:128:512\"' | ||
f' good-bundle.raucb {tmp_path}/desync-extra-args.raucb') | ||
|
||
assert exitcode == 0 | ||
|
||
assert os.path.exists(f'{tmp_path}/desync-extra-args.raucb') |