blob: a0e8069134e70c924e19d802169804b159ed860e [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)
54
55TEST_SUITE(boot_test_main)
56{
57 boot_test_nv_ns_10();
58 boot_test_nv_ns_01();
59 boot_test_nv_ns_11();
60 boot_test_vm_ns_10();
61 boot_test_vm_ns_01();
62 boot_test_vm_ns_11_a();
63 boot_test_vm_ns_11_b();
64 boot_test_vm_ns_11_2areas();
65 boot_test_nv_bs_10();
66 boot_test_nv_bs_11();
67 boot_test_nv_bs_11_2areas();
68 boot_test_vb_ns_11();
69 boot_test_no_hash();
70 boot_test_no_flag_has_hash();
71 boot_test_invalid_hash();
72 boot_test_revert();
73 boot_test_revert_continue();
74}
75
76int
77boot_test_all(void)
78{
79 boot_test_main();
80 return tu_any_failed;
81}
82
83#if MYNEWT_VAL(SELFTEST)
84
85int
86main(int argc, char **argv)
87{
88 ts_config.ts_print_results = 1;
89 tu_parse_args(argc, argv);
90
91 tu_init();
92
93 boot_test_all();
94
95 return tu_any_failed;
96}
97
98#endif