implemented testClass and testPriority
This commit is contained in:
parent
9781ecb1f7
commit
180024b76d
|
@ -4,6 +4,7 @@ from typing import OrderedDict, Tuple, List
|
|||
|
||||
import collections
|
||||
import fdb
|
||||
import fdb.tuple
|
||||
import struct
|
||||
|
||||
from test_harness.run import StatFetcher, TestDescription
|
||||
|
@ -29,6 +30,7 @@ def open_db(cluster_file: str | None):
|
|||
fdb_db = fdb.open(cluster_file)
|
||||
return fdb_db
|
||||
|
||||
|
||||
def chunkify(iterable, sz: int):
|
||||
count = 0
|
||||
res = []
|
||||
|
@ -44,17 +46,34 @@ def chunkify(iterable, sz: int):
|
|||
|
||||
|
||||
@fdb.transactional
|
||||
def write_coverage_chunk(tr, path: Tuple[str, ...], coverage: List[Tuple[Coverage, bool]]):
|
||||
def write_coverage_chunk(tr, path: Tuple[str, ...], metadata: Tuple[str, ...],
|
||||
coverage: List[Tuple[Coverage, bool]], initialized: bool) -> bool:
|
||||
cov_dir = fdb.directory.create_or_open(tr, path)
|
||||
if not initialized:
|
||||
metadata_dir = fdb.directory.create_or_open(tr, metadata)
|
||||
v = tr[metadata_dir['initialized']]
|
||||
initialized = v.present()
|
||||
for cov, covered in coverage:
|
||||
tr.add(cov_dir.pack((cov.file, cov.line, cov.comment)), struct.pack('<I', 1 if covered else 0))
|
||||
if not initialized or covered:
|
||||
tr.add(cov_dir.pack((cov.file, cov.line, cov.comment)), struct.pack('<I', 1 if covered else 0))
|
||||
return initialized
|
||||
|
||||
|
||||
def write_coverage(cluster_file: str | None, cov_path: Tuple[str, ...], coverage: OrderedDict[Coverage, bool]):
|
||||
@fdb.transactional
|
||||
def set_initialized(tr, metadata: Tuple[str, ...]):
|
||||
metadata_dir = fdb.directory.create_or_open(tr, metadata)
|
||||
tr[metadata_dir['initialized']] = fdb.tuple.pack((True,))
|
||||
|
||||
|
||||
def write_coverage(cluster_file: str | None, cov_path: Tuple[str, ...], metadata: Tuple[str, ...],
|
||||
coverage: OrderedDict[Coverage, bool]):
|
||||
db = open_db(cluster_file)
|
||||
assert config.joshua_dir is not None
|
||||
initialized: bool = False
|
||||
for chunk in chunkify(coverage.items(), 100):
|
||||
write_coverage_chunk(db, cov_path, chunk)
|
||||
initialized = write_coverage_chunk(db, cov_path, metadata, chunk, initialized)
|
||||
if not initialized:
|
||||
set_initialized(db, metadata)
|
||||
|
||||
|
||||
@fdb.transactional
|
||||
|
|
|
@ -47,9 +47,10 @@ class EnsembleResults:
|
|||
self.global_statistics.total_cpu_time += v.runtime
|
||||
self.stats.append((k, v.runtime, v.run_count))
|
||||
self.stats.sort(key=lambda x: x[1], reverse=True)
|
||||
self.coverage_ok: bool = self.min_coverage_hit is not None
|
||||
if self.coverage_ok:
|
||||
if self.min_coverage_hit is not None:
|
||||
self.coverage_ok = self.min_coverage_hit > self.ratio
|
||||
else:
|
||||
self.coverage_ok = False
|
||||
|
||||
def dump(self, prefix: str):
|
||||
errors = 0
|
||||
|
@ -70,7 +71,7 @@ class EnsembleResults:
|
|||
child.attributes['Severity'] = str(severity)
|
||||
child.attributes['File'] = cov.file
|
||||
child.attributes['Line'] = str(cov.line)
|
||||
child.attributes['Comment'] = cov.comment
|
||||
child.attributes['Comment'] = '' if cov.comment is None else cov.comment
|
||||
child.attributes['HitCount'] = str(count)
|
||||
out.append(child)
|
||||
|
||||
|
|
|
@ -396,6 +396,7 @@ class Summary:
|
|||
import test_harness.fdb
|
||||
test_harness.fdb.write_coverage(config.cluster_file,
|
||||
test_harness.fdb.str_to_tuple(config.joshua_dir) + ('coverage',),
|
||||
test_harness.fdb.str_to_tuple(config.joshua_dir) + ('coverage-metadata',),
|
||||
self.coverage)
|
||||
|
||||
def ok(self):
|
||||
|
|
|
@ -84,7 +84,7 @@ bool destructed = false;
|
|||
class TestConfig {
|
||||
class ConfigBuilder {
|
||||
using value_type = toml::basic_value<toml::discard_comments>;
|
||||
using base_variant = std::variant<int, bool, std::string, std::vector<int>, ConfigDBType>;
|
||||
using base_variant = std::variant<int, float, double, bool, std::string, std::vector<int>, ConfigDBType>;
|
||||
using types =
|
||||
variant_map<variant_concat<base_variant, variant_map<base_variant, Optional>>, std::add_pointer_t>;
|
||||
std::unordered_map<std::string_view, types> confMap;
|
||||
|
@ -94,6 +94,10 @@ class TestConfig {
|
|||
visitor(const value_type& v) : value(v) {}
|
||||
void operator()(int* val) const { *val = value.as_integer(); }
|
||||
void operator()(Optional<int>* val) const { *val = value.as_integer(); }
|
||||
void operator()(float* val) const { *val = value.as_floating(); }
|
||||
void operator()(Optional<float>* val) const { *val = value.as_floating(); }
|
||||
void operator()(double* val) const { *val = value.as_floating(); }
|
||||
void operator()(Optional<double>* val) const { *val = value.as_floating(); }
|
||||
void operator()(bool* val) const { *val = value.as_boolean(); }
|
||||
void operator()(Optional<bool>* val) const { *val = value.as_boolean(); }
|
||||
void operator()(std::string* val) const { *val = value.as_string(); }
|
||||
|
@ -344,6 +348,8 @@ public:
|
|||
bool allowCreatingTenants = true;
|
||||
bool injectTargetedSSRestart = false;
|
||||
bool injectSSDelay = false;
|
||||
std::string testClass; // unused -- used in TestHarness
|
||||
float testPriority; // unused -- used in TestHarness
|
||||
|
||||
ConfigDBType getConfigDBType() const { return configDBType; }
|
||||
|
||||
|
@ -371,7 +377,9 @@ public:
|
|||
}
|
||||
std::string extraDatabaseModeStr;
|
||||
ConfigBuilder builder;
|
||||
builder.add("extraDatabaseMode", &extraDatabaseModeStr)
|
||||
builder.add("testClass", &testClass)
|
||||
.add("testPriority", &testPriority)
|
||||
.add("extraDatabaseMode", &extraDatabaseModeStr)
|
||||
.add("extraDatabaseCount", &extraDatabaseCount)
|
||||
.add("minimumReplication", &minimumReplication)
|
||||
.add("minimumRegions", &minimumRegions)
|
||||
|
|
|
@ -1146,6 +1146,9 @@ ACTOR Future<bool> runTest(Database cx,
|
|||
std::map<std::string, std::function<void(const std::string&)>> testSpecGlobalKeys = {
|
||||
// These are read by SimulatedCluster and used before testers exist. Thus, they must
|
||||
// be recognized and accepted, but there's no point in placing them into a testSpec.
|
||||
// testClass and testPriority are only used for TestHarness, we'll ignore those here
|
||||
{ "testClass", [](std::string const&) {} },
|
||||
{ "testPriority", [](std::string const&) {} },
|
||||
{ "extraDatabaseMode",
|
||||
[](const std::string& value) { TraceEvent("TestParserTest").detail("ParsedExtraDatabaseMode", ""); } },
|
||||
{ "extraDatabaseCount",
|
||||
|
|
|
@ -256,6 +256,7 @@ FORMAT_TRACEABLE(long int, "%ld");
|
|||
FORMAT_TRACEABLE(unsigned long int, "%lu");
|
||||
FORMAT_TRACEABLE(long long int, "%lld");
|
||||
FORMAT_TRACEABLE(unsigned long long int, "%llu");
|
||||
FORMAT_TRACEABLE(float, "%g");
|
||||
FORMAT_TRACEABLE(double, "%g");
|
||||
FORMAT_TRACEABLE(void*, "%p");
|
||||
FORMAT_TRACEABLE(volatile long, "%ld");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
testClass = "Backup"
|
||||
|
||||
[[test]]
|
||||
testTitle = 'Cycle'
|
||||
clearAfterTest = 'false'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
testClass = "Backup"
|
||||
|
||||
[[test]]
|
||||
testTitle = 'BackupAndRestore'
|
||||
clearAfterTest = false
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
testClass = "Backup"
|
||||
|
||||
[[test]]
|
||||
testTitle = 'BackupAndRestore'
|
||||
clearAfterTest = false
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
testClass = "Backup"
|
||||
|
||||
[[test]]
|
||||
testTitle = 'Cycle'
|
||||
clearAfterTest = 'false'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
testClass = "Backup"
|
||||
|
||||
[configuration]
|
||||
extraDatabaseMode = 'LocalOrSingle'
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
testClass = "Backup"
|
||||
|
||||
[configuration]
|
||||
extraDatabaseMode = 'LocalOrSingle'
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[configuration]
|
||||
testClass = "BlobGranule"
|
||||
blobGranulesEnabled = true
|
||||
allowDefaultTenant = false
|
||||
# FIXME: re-enable rocks at some point
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[configuration]
|
||||
testClass = "BlobGranule"
|
||||
blobGranulesEnabled = true
|
||||
allowDefaultTenant = false
|
||||
injectTargetedSSRestart = true
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[configuration]
|
||||
testClass = "BlobGranule"
|
||||
blobGranulesEnabled = true
|
||||
allowDefaultTenant = false
|
||||
injectTargetedSSRestart = true
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[configuration]
|
||||
testClass = "BlobGranule"
|
||||
blobGranulesEnabled = true
|
||||
allowDefaultTenant = false
|
||||
injectTargetedSSRestart = true
|
||||
|
|
|
@ -3,6 +3,7 @@ blobGranulesEnabled = true
|
|||
allowDefaultTenant = false
|
||||
# FIXME: re-enable rocks at some point
|
||||
storageEngineExcludeTypes = [4, 5]
|
||||
testClass = "BlobGranule"
|
||||
|
||||
[[test]]
|
||||
testTitle = 'BlobGranuleVerifySmallClean'
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[configuration]
|
||||
allowDefaultTenant = false
|
||||
testClass = "ChangeFeeds"
|
||||
|
||||
# TODO add failure events, and then add a version that also supports randomMoveKeys
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[configuration]
|
||||
testClass = "ChangeFeeds"
|
||||
allowDefaultTenant = false
|
||||
|
||||
# TODO add failure events, and then add a version that also supports randomMoveKeys
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[configuration]
|
||||
testClass = "ChangeFeeds"
|
||||
allowDefaultTenant = false
|
||||
|
||||
[[test]]
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
[configuration]
|
||||
testClass = "Encryption"
|
||||
|
||||
[[knobs]]
|
||||
enable_encryption = true
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
[configuration]
|
||||
testClass = "Encryption"
|
||||
|
||||
[[knobs]]
|
||||
enable_encryption = false
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
testClass = "Backup"
|
||||
storageEngineExcludeTypes=3
|
||||
|
||||
[[test]]
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
testClass = "Backup"
|
||||
|
||||
[[test]]
|
||||
testTitle = 'SecondCycleTest'
|
||||
simBackupAgents = 'BackupToFile'
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
testClass=SnapshotTest
|
||||
storageEngineExcludeTypes=[3, 4, 5]
|
||||
|
||||
;Take snap and do cycle test
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
testClass=SnapshotTest
|
||||
storageEngineExcludeTypes=[4, 5]
|
||||
buggify=off
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
testClass=SnapshotTest
|
||||
storageEngineExcludeTypes=[3, 4, 5]
|
||||
|
||||
logAntiQuorum = 0
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
testClass=SnapshotTest
|
||||
storageEngineExcludeTypes=[4, 5]
|
||||
|
||||
testTitle=RestoreBackup
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
testClass=SnapshotTest
|
||||
storageEngineExcludeTypes=[3, 4, 5]
|
||||
|
||||
;write 1000 Keys ending with even numbers
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
testClass=SnapshotTest
|
||||
storageEngineExcludeTypes=[4, 5]
|
||||
|
||||
buggify=off
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
testClass=SnapshotTest
|
||||
storageEngineExcludeTypes=[3, 4, 5]
|
||||
|
||||
;write 1000 Keys ending with even numbers
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
testClass=SnapshotTest
|
||||
storageEngineExcludeTypes=[4, 5]
|
||||
|
||||
buggify=off
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
testClass=SnapshotTest
|
||||
storageEngineExcludeTypes=[3, 4, 5]
|
||||
|
||||
;write 1000 Keys ending with even number
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
testClass=SnapshotTest
|
||||
storageEngineExcludeTypes=[4, 5]
|
||||
|
||||
buggify=off
|
||||
|
|
Loading…
Reference in New Issue