mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 02:05:01 +00:00
Revert "futility: add tests for futil_file_type()"
This reverts commit 271c071344.
BUG=chromium:466433
TEST=None.
Change-Id: Ic84d069d672a76b46201a0e3700801a1e6d47438
Reviewed-on: https://chromium-review.googlesource.com/259364
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
This commit is contained in:
7
Makefile
7
Makefile
@@ -683,7 +683,6 @@ TEST_NAMES = \
|
|||||||
tests/vboot_nvstorage_test \
|
tests/vboot_nvstorage_test \
|
||||||
tests/verify_kernel \
|
tests/verify_kernel \
|
||||||
tests/futility/binary_editor \
|
tests/futility/binary_editor \
|
||||||
tests/futility/test_file_types \
|
|
||||||
tests/futility/test_not_really
|
tests/futility/test_not_really
|
||||||
|
|
||||||
ifdef REGION_READ
|
ifdef REGION_READ
|
||||||
@@ -1177,11 +1176,6 @@ ${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition
|
|||||||
${BUILD}/tests/%: LDLIBS += -lrt -luuid
|
${BUILD}/tests/%: LDLIBS += -lrt -luuid
|
||||||
${BUILD}/tests/%: LIBS += ${TESTLIB}
|
${BUILD}/tests/%: LIBS += ${TESTLIB}
|
||||||
|
|
||||||
# Futility tests need almost everything that futility needs.
|
|
||||||
${BUILD}/tests/futility/%: INCLUDES += -Ifutility
|
|
||||||
${BUILD}/tests/futility/%: OBJS += ${FUTIL_OBJS} ${UTILLIB} ${UTILLIB21}
|
|
||||||
${BUILD}/tests/futility/%: LDLIBS += ${CRYPTO_LIBS}
|
|
||||||
|
|
||||||
${BUILD}/tests/rollback_index2_tests: OBJS += \
|
${BUILD}/tests/rollback_index2_tests: OBJS += \
|
||||||
${BUILD}/firmware/lib/rollback_index_for_test.o
|
${BUILD}/firmware/lib/rollback_index_for_test.o
|
||||||
${BUILD}/tests/rollback_index2_tests: \
|
${BUILD}/tests/rollback_index2_tests: \
|
||||||
@@ -1354,7 +1348,6 @@ run2tests: test_setup
|
|||||||
.PHONY: runfutiltests
|
.PHONY: runfutiltests
|
||||||
runfutiltests: test_setup
|
runfutiltests: test_setup
|
||||||
tests/futility/run_test_scripts.sh ${TEST_INSTALL_DIR}/bin
|
tests/futility/run_test_scripts.sh ${TEST_INSTALL_DIR}/bin
|
||||||
${RUNTEST} ${BUILD_RUN}/tests/futility/test_file_types
|
|
||||||
${RUNTEST} ${BUILD_RUN}/tests/futility/test_not_really
|
${RUNTEST} ${BUILD_RUN}/tests/futility/test_not_really
|
||||||
|
|
||||||
# Run long tests, including all permutations of encryption keys (instead of
|
# Run long tests, including all permutations of encryption keys (instead of
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,95 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2015 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.
|
|
||||||
*/
|
|
||||||
#include <limits.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "file_type.h"
|
|
||||||
#include "futility.h"
|
|
||||||
#include "test_common.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Files that exemplify each type.
|
|
||||||
* Paths are relative to the source directory.
|
|
||||||
* A missing path means we don't (yet?) know how to identify it reliably.
|
|
||||||
*/
|
|
||||||
static struct {
|
|
||||||
enum futil_file_type type;
|
|
||||||
const char * const file;
|
|
||||||
} test_case[] = {
|
|
||||||
{FILE_TYPE_UNKNOWN, "tests/futility/data/random_noise.bin"},
|
|
||||||
{FILE_TYPE_PUBKEY, "tests/devkeys/root_key.vbpubk"},
|
|
||||||
{FILE_TYPE_KEYBLOCK, "tests/devkeys/kernel.keyblock"},
|
|
||||||
{FILE_TYPE_FW_PREAMBLE, "tests/futility/data/fw_vblock.bin"},
|
|
||||||
{FILE_TYPE_GBB, "tests/futility/data/fw_gbb.bin"},
|
|
||||||
{FILE_TYPE_BIOS_IMAGE, "tests/futility/data/bios_zgb_mp.bin"},
|
|
||||||
{FILE_TYPE_OLD_BIOS_IMAGE, "tests/futility/data/bios_mario_mp.bin"},
|
|
||||||
{FILE_TYPE_KERN_PREAMBLE, "tests/futility/data/kern_preamble.bin"},
|
|
||||||
{FILE_TYPE_RAW_FIRMWARE, },
|
|
||||||
{FILE_TYPE_RAW_KERNEL, },
|
|
||||||
{FILE_TYPE_CHROMIUMOS_DISK, },
|
|
||||||
{FILE_TYPE_PRIVKEY, "tests/devkeys/root_key.vbprivk"},
|
|
||||||
{FILE_TYPE_VB2_PUBKEY, "tests/futility/data/sample.vbpubk2"},
|
|
||||||
{FILE_TYPE_VB2_PRIVKEY, "tests/futility/data/sample.vbprik2"},
|
|
||||||
{FILE_TYPE_PEM, "tests/testkeys/key_rsa2048.pem"},
|
|
||||||
};
|
|
||||||
BUILD_ASSERT(ARRAY_SIZE(test_case) == NUM_FILE_TYPES);
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
char filename[PATH_MAX];
|
|
||||||
char status[80];
|
|
||||||
char *srcdir;
|
|
||||||
enum futil_file_type type;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Where's the source directory? */
|
|
||||||
srcdir = getenv("SRCDIR");
|
|
||||||
if (argc > 1)
|
|
||||||
srcdir = argv[1];
|
|
||||||
if (!srcdir)
|
|
||||||
srcdir = ".";
|
|
||||||
|
|
||||||
/* Complain about some files we can't handle */
|
|
||||||
TEST_EQ(futil_file_type("/Sir/Not/Appearing/In/This/Film", &type),
|
|
||||||
FILE_ERR_OPEN, "Identify missing file");
|
|
||||||
TEST_EQ(futil_file_type("/", &type),
|
|
||||||
FILE_ERR_DIR, "Identify directory");
|
|
||||||
TEST_EQ(futil_file_type("/dev/zero", &type),
|
|
||||||
FILE_ERR_CHR, "Identify char device");
|
|
||||||
|
|
||||||
/* Now test things we can handle */
|
|
||||||
for (i = 0; i < NUM_FILE_TYPES; i++) {
|
|
||||||
|
|
||||||
if (!test_case[i].file) {
|
|
||||||
printf("%sWarning: No test for file type %d (%s)%s\n",
|
|
||||||
COL_YELLOW, test_case[i].type,
|
|
||||||
futil_file_type_str(test_case[i].type),
|
|
||||||
COL_STOP);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(filename, sizeof(filename), "%s/%s",
|
|
||||||
srcdir, test_case[i].file);
|
|
||||||
|
|
||||||
type = NUM_FILE_TYPES;
|
|
||||||
snprintf(status, sizeof(status),
|
|
||||||
"File type %d (%s): examined",
|
|
||||||
test_case[i].type,
|
|
||||||
futil_file_type_str(test_case[i].type));
|
|
||||||
TEST_EQ(FILE_ERR_NONE, futil_file_type(filename, &type),
|
|
||||||
status);
|
|
||||||
|
|
||||||
snprintf(status, sizeof(status),
|
|
||||||
"File type %d (%s) identified",
|
|
||||||
test_case[i].type,
|
|
||||||
futil_file_type_str(test_case[i].type));
|
|
||||||
TEST_EQ(type, test_case[i].type, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
return !gTestSuccess;
|
|
||||||
}
|
|
||||||
@@ -51,7 +51,6 @@ int TEST_SUCC(int result, const char* testname);
|
|||||||
* Don't use \e as MSC does not recognize it as a valid escape sequence.
|
* Don't use \e as MSC does not recognize it as a valid escape sequence.
|
||||||
*/
|
*/
|
||||||
#define COL_GREEN "\x1b[1;32m"
|
#define COL_GREEN "\x1b[1;32m"
|
||||||
#define COL_YELLOW "\x1b[1;33m"
|
|
||||||
#define COL_RED "\x1b[0;31m"
|
#define COL_RED "\x1b[0;31m"
|
||||||
#define COL_STOP "\x1b[m"
|
#define COL_STOP "\x1b[m"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user