Improve code coverage of MultiCommand class

This change introduces ULTs for untested
parts of MultiCommand class. Furthermore,
it contains MockMultiCommand class, which
allows white-box testing.

Related-To: NEO-6834
Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
This commit is contained in:
Patryk Wrobel
2022-03-31 15:11:55 +00:00
committed by Compute-Runtime-Automation
parent f2a18370e8
commit 9cba46e5bf
7 changed files with 208 additions and 4 deletions

View File

@@ -159,7 +159,7 @@ Usage: ocloc multi <file_name>
<file_name> Input file containing a list of arguments for subsequent
ocloc invocations.
Expected format of each line inside such file is:
'-file <filename> -device <device_type> [compile_options].
'-file <filename> -device <device_type> [compile_options]'.
See 'ocloc compile --help' for available compile_options.
Results of subsequent compilations will be dumped into
a directory with name indentical file_name's base name.

View File

@@ -1,10 +1,12 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/offline_compiler/source/decoder/binary_decoder.h"
#include "shared/offline_compiler/source/decoder/binary_encoder.h"
#include "shared/offline_compiler/source/offline_compiler.h"
@@ -23,7 +25,7 @@ class MultiCommand {
public:
MultiCommand &operator=(const MultiCommand &) = delete;
MultiCommand(const MultiCommand &) = delete;
~MultiCommand() = default;
MOCKABLE_VIRTUAL ~MultiCommand() = default;
static MultiCommand *create(const std::vector<std::string> &args, int &retVal, OclocArgHelper *helper);

View File

@@ -118,7 +118,7 @@ class OclocArgHelper {
PRODUCT_CONFIG findConfigMatch(const std::string &device, bool firstAppearance);
void insertGenNames(GFXCORE_FAMILY family);
std::vector<std::string> headersToVectorOfStrings();
void readFileToVectorOfStrings(const std::string &filename, std::vector<std::string> &lines);
MOCKABLE_VIRTUAL void readFileToVectorOfStrings(const std::string &filename, std::vector<std::string> &lines);
MOCKABLE_VIRTUAL std::vector<char> readBinaryFile(const std::string &filename);
MOCKABLE_VIRTUAL std::unique_ptr<char[]> loadDataFromFile(const std::string &filename, size_t &retSize);