Alice Wang | 95c1b92 | 2022-07-20 11:37:51 +0000 | [diff] [blame^] | 1 | // Copyright 2022, The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | //! Tests for avmdtool. |
| 16 | |
| 17 | use std::fs; |
| 18 | use std::process::Command; |
| 19 | |
| 20 | #[test] |
| 21 | fn test_dump() { |
| 22 | // test.avmd is generated with |
| 23 | // ``` |
| 24 | // avmdtool create /tmp/test.amvd \ |
| 25 | // --apex-payload microdroid vbmeta ./libs/apexutil/tests/data/test.apex \ |
| 26 | // --apk microdroid_manager apk \ |
| 27 | // ./libs/apkverify/tests/data/v3-only-with-rsa-pkcs1-sha256-4096.apk \ |
| 28 | // --apk microdroid_manager extra-apk ./libs/apkverify/tests/data/v3-only-with-stamp.apk |
| 29 | //``` |
| 30 | let output = |
| 31 | Command::new("./avmdtool").args(["dump", "tests/data/test.avmd"]).output().unwrap(); |
| 32 | assert!(output.status.success()); |
| 33 | assert_eq!(output.stdout, fs::read("tests/data/test.avmd.dump").unwrap()); |
| 34 | } |