summaryrefslogtreecommitdiff
path: root/test/nvmem_test.h
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2019-02-28 20:05:27 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-04-05 09:21:44 -0700
commit1d6c7bb9773f76aa70ce65822fa001ff72892cd2 (patch)
tree3631462d9540df08d13cffa9a7f8e7e9bb3e7899 /test/nvmem_test.h
parent63bf8f8ba87b23378391b147f1b3e9fdcf3d8dc5 (diff)
downloadchrome-ec-1d6c7bb9773f76aa70ce65822fa001ff72892cd2.tar.gz
nvmem: test modifications to support the new scheme
This patch includes changes to support testing of the new nvmem implementation. Making fizz compatible required duplicating a lot of functionality available in the test/ directory (fuzz/nvmem_tpm2_mock.c is very similar to test/nvmem_tpm2_mock.c), but I could not find an easy way to avoid it. BRANCH=cr50, cr50-mp BUG=b:69907320, b:129710256 CQ-DEPEND=CL:1496607 TEST=with the rest of the patches applied 'make buildall -j' succeeds, which confirms both test and fuzz success. Change-Id: Ife999b04d22f8ddbe9ea5d35f4c3e21f57592754 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1450278 Reviewed-by: Andrey Pronin <apronin@chromium.org>
Diffstat (limited to 'test/nvmem_test.h')
-rw-r--r--test/nvmem_test.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/nvmem_test.h b/test/nvmem_test.h
new file mode 100644
index 0000000000..f8f166dc5e
--- /dev/null
+++ b/test/nvmem_test.h
@@ -0,0 +1,28 @@
+/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __EC_TEST_NVMEM_TEST_H
+#define __EC_TEST_NVMEM_TEST_H
+
+#define EMBEDDED_MODE 1
+#define NV_C
+#include "Global.h"
+#undef NV_C
+#include "NV_fp.h"
+#include "tpm_generated.h"
+
+enum test_failure_mode {
+ TEST_NO_FAILURE,
+ TEST_FAIL_WHEN_SAVING,
+ TEST_FAIL_WHEN_INVALIDATING,
+ TEST_FAIL_WHEN_COMPACTING
+};
+
+extern enum test_failure_mode failure_mode;
+
+size_t add_evictable_obj(void *obj, size_t obj_size);
+void drop_evictable_obj(void *obj);
+
+#endif /* ! __EC_TEST_NVMEM_TEST_H */