1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-03-03 14:52:21 +02:00

Add explicit keyword for covered modules included in other modules.

This was done by checking the extension but it is possible to include a module that does not have a vendor or auto extension. Instead make it explicit that the module is included in another module.

Also change the variable from "include" to "included" to make it clearer what it indicates.
This commit is contained in:
David Steele 2022-12-31 10:10:44 +07:00
parent 729d7f071d
commit d517d4a328
4 changed files with 15 additions and 9 deletions

View File

@ -16,7 +16,8 @@
# Some options are unique to tests: # Some options are unique to tests:
# * coverage - a list of code modules that the test provides coverage for. A code module may be covered by multiple tests. That # * coverage - a list of code modules that the test provides coverage for. A code module may be covered by multiple tests. That
# means you must run all the tests by providing the --run option multiple times to get full coverage on the code module. If # means you must run all the tests by providing the --run option multiple times to get full coverage on the code module. If
# a code module contains only data it should be marked noCode (e.g. - help/help.auto.c: noCode). # a code module contains only data it should be marked noCode (e.g. - help/help.auto: noCode). If a code module is included
# in another code module it should be marked as included (e.g. - md5.vendor: included).
# * feature - Defines a feature that is now available in the harness. For example, the "error" feature defines HRN_FEATURE_ERROR # * feature - Defines a feature that is now available in the harness. For example, the "error" feature defines HRN_FEATURE_ERROR
# used to automatically check for errors in later tests. The common/error test is not able to access this error handling # used to automatically check for errors in later tests. The common/error test is not able to access this error handling
# because it is used to implement the error handling, so it must do error testing in a more primitive way. # because it is used to implement the error handling, so it must do error testing in a more primitive way.
@ -328,7 +329,7 @@ unit:
- common/crypto/cipherBlock - common/crypto/cipherBlock
- common/crypto/common - common/crypto/common
- common/crypto/hash - common/crypto/hash
- common/crypto/md5.vendor - common/crypto/md5.vendor: included
# ---------------------------------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------------------------------
- name: io-tls - name: io-tls

View File

@ -527,7 +527,7 @@ testBldUnit(TestBuild *const this)
{ {
const TestDefCoverage *const coverage = lstGet(module->coverageList, coverageIdx); const TestDefCoverage *const coverage = lstGet(module->coverageList, coverageIdx);
if (coverage->coverable && !coverage->include) if (coverage->coverable && !coverage->included)
strLstAdd(testIncludeFileList, coverage->name); strLstAdd(testIncludeFileList, coverage->name);
} }
} }

View File

@ -92,14 +92,19 @@ testDefParseModuleList(Yaml *const yaml, List *const moduleList)
YAML_MAP_BEGIN(yaml) YAML_MAP_BEGIN(yaml)
{ {
testDefCoverage.name = yamlScalarNext(yaml).value; testDefCoverage.name = yamlScalarNext(yaml).value;
yamlScalarNextCheckZ(yaml, "noCode"); const String *const type = yamlScalarNext(yaml).value;
testDefCoverage.included = true;
if (strEqZ(type, "included"))
{
testDefCoverage.coverable = true;
}
else if (!strEqZ(type, "noCode"))
THROW_FMT(FormatError, "invalid coverage type '%s'", strZ(type));
} }
YAML_MAP_END(); YAML_MAP_END();
} }
testDefCoverage.include =
strEndsWithZ(testDefCoverage.name, ".vendor") || strEndsWithZ(testDefCoverage.name, ".auto");
MEM_CONTEXT_OBJ_BEGIN(coverageList) MEM_CONTEXT_OBJ_BEGIN(coverageList)
{ {
testDefCoverage.name = strDup(testDefCoverage.name); testDefCoverage.name = strDup(testDefCoverage.name);
@ -108,7 +113,7 @@ testDefParseModuleList(Yaml *const yaml, List *const moduleList)
MEM_CONTEXT_OBJ_END(); MEM_CONTEXT_OBJ_END();
// Also add to the global depend list // Also add to the global depend list
if (testDefCoverage.coverable && !testDefCoverage.include) if (testDefCoverage.coverable && !testDefCoverage.included)
strLstAddIfMissing(globalDependList, testDefCoverage.name); strLstAddIfMissing(globalDependList, testDefCoverage.name);
} }
YAML_SEQ_END(); YAML_SEQ_END();

View File

@ -21,7 +21,7 @@ typedef struct TestDefCoverage
{ {
const String *name; // Code module name const String *name; // Code module name
bool coverable; // Does this code module include coverable code? bool coverable; // Does this code module include coverable code?
bool include; // Is this module included in another module? bool included; // Is this module included in another module?
} TestDefCoverage; } TestDefCoverage;
// Harness modules // Harness modules