blob: 98972f3ec1da4e76d2525c7db0e22cf7abe673dc [file] [log] [blame]
Christopher Collins92ea77f2016-12-12 15:59:26 -08001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#include <assert.h>
21#include <stddef.h>
22#include <stdio.h>
23#include <stdlib.h>
24#include <string.h>
25#include <inttypes.h>
26#include "syscfg/syscfg.h"
27#include "sysflash/sysflash.h"
28#include "testutil/testutil.h"
29#include "hal/hal_flash.h"
30#include "flash_map/flash_map.h"
31#include "bootutil/image.h"
32#include "bootutil/bootutil.h"
33#include "bootutil_priv.h"
34
35#include "mbedtls/sha256.h"
36
37TEST_CASE_DECL(boot_test_nv_ns_10)
38TEST_CASE_DECL(boot_test_nv_ns_01)
39TEST_CASE_DECL(boot_test_nv_ns_11)
40TEST_CASE_DECL(boot_test_vm_ns_10)
41TEST_CASE_DECL(boot_test_vm_ns_01)
42TEST_CASE_DECL(boot_test_vm_ns_11_a)
43TEST_CASE_DECL(boot_test_vm_ns_11_b)
44TEST_CASE_DECL(boot_test_vm_ns_11_2areas)
45TEST_CASE_DECL(boot_test_nv_bs_10)
46TEST_CASE_DECL(boot_test_nv_bs_11)
47TEST_CASE_DECL(boot_test_nv_bs_11_2areas)
48TEST_CASE_DECL(boot_test_vb_ns_11)
49TEST_CASE_DECL(boot_test_no_hash)
50TEST_CASE_DECL(boot_test_no_flag_has_hash)
51TEST_CASE_DECL(boot_test_invalid_hash)
52TEST_CASE_DECL(boot_test_revert)
53TEST_CASE_DECL(boot_test_revert_continue)
Christopher Collins7835c1e2016-12-21 10:10:51 -080054TEST_CASE_DECL(boot_test_permanent)
55TEST_CASE_DECL(boot_test_permanent_continue)
Christopher Collins92ea77f2016-12-12 15:59:26 -080056
57TEST_SUITE(boot_test_main)
58{
59 boot_test_nv_ns_10();
60 boot_test_nv_ns_01();
61 boot_test_nv_ns_11();
62 boot_test_vm_ns_10();
63 boot_test_vm_ns_01();
64 boot_test_vm_ns_11_a();
65 boot_test_vm_ns_11_b();
66 boot_test_vm_ns_11_2areas();
67 boot_test_nv_bs_10();
68 boot_test_nv_bs_11();
69 boot_test_nv_bs_11_2areas();
70 boot_test_vb_ns_11();
71 boot_test_no_hash();
72 boot_test_no_flag_has_hash();
73 boot_test_invalid_hash();
74 boot_test_revert();
75 boot_test_revert_continue();
Christopher Collins7835c1e2016-12-21 10:10:51 -080076 boot_test_permanent();
77 boot_test_permanent_continue();
Christopher Collins92ea77f2016-12-12 15:59:26 -080078}
79
80int
81boot_test_all(void)
82{
83 boot_test_main();
84 return tu_any_failed;
85}
86
87#if MYNEWT_VAL(SELFTEST)
88
89int
90main(int argc, char **argv)
91{
92 ts_config.ts_print_results = 1;
93 tu_parse_args(argc, argv);
94
95 tu_init();
96
97 boot_test_all();
98
99 return tu_any_failed;
100}
101
102#endif