mirror of
https://github.com/NixOS/nix.git
synced 2025-11-17 07:52:43 +01:00
Apply clang-format universally.
* It is tough to contribute to a project that doesn't use a formatter, * It is extra hard to contribute to a project which has configured the formatter, but ignores it for some files * Code formatting makes it harder to hide obscure / weird bugs by accident or on purpose, Let's rip the bandaid off? Note that PRs currently in flight should be able to be merged relatively easily by applying `clang-format` to their tip prior to merge. Co-authored-by: Graham Christensen <graham@grahamc.com>
This commit is contained in:
parent
9b8b5d8560
commit
95d9c13716
585 changed files with 23297 additions and 23164 deletions
|
|
@ -25,13 +25,12 @@ struct WorkerProtoTest : VersionedProtoTest<WorkerProto, workerProtoDir>
|
|||
WorkerProto::Version defaultVersion = 1 << 8 | 10;
|
||||
};
|
||||
|
||||
|
||||
VERSIONED_CHARACTERIZATION_TEST(
|
||||
WorkerProtoTest,
|
||||
string,
|
||||
"string",
|
||||
defaultVersion,
|
||||
(std::tuple<std::string, std::string, std::string, std::string, std::string> {
|
||||
(std::tuple<std::string, std::string, std::string, std::string, std::string>{
|
||||
"",
|
||||
"hi",
|
||||
"white rabbit",
|
||||
|
|
@ -46,9 +45,9 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
storePath,
|
||||
"store-path",
|
||||
defaultVersion,
|
||||
(std::tuple<StorePath, StorePath> {
|
||||
StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
||||
StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo-bar" },
|
||||
(std::tuple<StorePath, StorePath>{
|
||||
StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
|
||||
StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo-bar"},
|
||||
}))
|
||||
|
||||
VERSIONED_CHARACTERIZATION_TEST(
|
||||
|
|
@ -56,16 +55,16 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
contentAddress,
|
||||
"content-address",
|
||||
defaultVersion,
|
||||
(std::tuple<ContentAddress, ContentAddress, ContentAddress> {
|
||||
ContentAddress {
|
||||
(std::tuple<ContentAddress, ContentAddress, ContentAddress>{
|
||||
ContentAddress{
|
||||
.method = ContentAddressMethod::Raw::Text,
|
||||
.hash = hashString(HashAlgorithm::SHA256, "Derive(...)"),
|
||||
},
|
||||
ContentAddress {
|
||||
ContentAddress{
|
||||
.method = ContentAddressMethod::Raw::Flat,
|
||||
.hash = hashString(HashAlgorithm::SHA1, "blob blob..."),
|
||||
},
|
||||
ContentAddress {
|
||||
ContentAddress{
|
||||
.method = ContentAddressMethod::Raw::NixArchive,
|
||||
.hash = hashString(HashAlgorithm::SHA256, "(...)"),
|
||||
},
|
||||
|
|
@ -78,21 +77,23 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
derivedPath_1_29,
|
||||
"derived-path-1.29",
|
||||
1 << 8 | 29,
|
||||
(std::tuple<DerivedPath, DerivedPath, DerivedPath> {
|
||||
DerivedPath::Opaque {
|
||||
.path = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
||||
(std::tuple<DerivedPath, DerivedPath, DerivedPath>{
|
||||
DerivedPath::Opaque{
|
||||
.path = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
|
||||
},
|
||||
DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(StorePath {
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::All { },
|
||||
DerivedPath::Built{
|
||||
.drvPath = makeConstantStorePathRef(
|
||||
StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::All{},
|
||||
},
|
||||
DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(StorePath {
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::Names { "x", "y" },
|
||||
DerivedPath::Built{
|
||||
.drvPath = makeConstantStorePathRef(
|
||||
StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::Names{"x", "y"},
|
||||
},
|
||||
}))
|
||||
|
||||
|
|
@ -101,24 +102,26 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
derivedPath_1_30,
|
||||
"derived-path-1.30",
|
||||
1 << 8 | 30,
|
||||
(std::tuple<DerivedPath, DerivedPath, DerivedPath, DerivedPath> {
|
||||
DerivedPath::Opaque {
|
||||
.path = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
||||
(std::tuple<DerivedPath, DerivedPath, DerivedPath, DerivedPath>{
|
||||
DerivedPath::Opaque{
|
||||
.path = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
|
||||
},
|
||||
DerivedPath::Opaque {
|
||||
.path = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv" },
|
||||
DerivedPath::Opaque{
|
||||
.path = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv"},
|
||||
},
|
||||
DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(StorePath {
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::All { },
|
||||
DerivedPath::Built{
|
||||
.drvPath = makeConstantStorePathRef(
|
||||
StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::All{},
|
||||
},
|
||||
DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(StorePath {
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::Names { "x", "y" },
|
||||
DerivedPath::Built{
|
||||
.drvPath = makeConstantStorePathRef(
|
||||
StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::Names{"x", "y"},
|
||||
},
|
||||
}))
|
||||
|
||||
|
|
@ -127,12 +130,12 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
drvOutput,
|
||||
"drv-output",
|
||||
defaultVersion,
|
||||
(std::tuple<DrvOutput, DrvOutput> {
|
||||
(std::tuple<DrvOutput, DrvOutput>{
|
||||
{
|
||||
.drvHash = Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
||||
.outputName = "baz",
|
||||
},
|
||||
DrvOutput {
|
||||
DrvOutput{
|
||||
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "quux",
|
||||
},
|
||||
|
|
@ -143,115 +146,110 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
realisation,
|
||||
"realisation",
|
||||
defaultVersion,
|
||||
(std::tuple<Realisation, Realisation> {
|
||||
Realisation {
|
||||
.id = DrvOutput {
|
||||
.drvHash = Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
||||
.outputName = "baz",
|
||||
},
|
||||
.outPath = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
||||
.signatures = { "asdf", "qwer" },
|
||||
(std::tuple<Realisation, Realisation>{
|
||||
Realisation{
|
||||
.id =
|
||||
DrvOutput{
|
||||
.drvHash = Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
||||
.outputName = "baz",
|
||||
},
|
||||
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
|
||||
.signatures = {"asdf", "qwer"},
|
||||
},
|
||||
Realisation {
|
||||
.id = {
|
||||
.drvHash = Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
||||
.outputName = "baz",
|
||||
},
|
||||
.outPath = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
||||
.signatures = { "asdf", "qwer" },
|
||||
.dependentRealisations = {
|
||||
Realisation{
|
||||
.id =
|
||||
{
|
||||
DrvOutput {
|
||||
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "quux",
|
||||
},
|
||||
StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
||||
.drvHash = Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
||||
.outputName = "baz",
|
||||
},
|
||||
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
|
||||
.signatures = {"asdf", "qwer"},
|
||||
.dependentRealisations =
|
||||
{
|
||||
{
|
||||
DrvOutput{
|
||||
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "quux",
|
||||
},
|
||||
StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
VERSIONED_CHARACTERIZATION_TEST(WorkerProtoTest, buildResult_1_27, "build-result-1.27", 1 << 8 | 27, ({
|
||||
using namespace std::literals::chrono_literals;
|
||||
std::tuple<BuildResult, BuildResult, BuildResult> t{
|
||||
BuildResult{
|
||||
.status = BuildResult::OutputRejected,
|
||||
.errorMsg = "no idea why",
|
||||
},
|
||||
BuildResult{
|
||||
.status = BuildResult::NotDeterministic,
|
||||
.errorMsg = "no idea why",
|
||||
},
|
||||
BuildResult{
|
||||
.status = BuildResult::Built,
|
||||
},
|
||||
};
|
||||
t;
|
||||
}))
|
||||
|
||||
VERSIONED_CHARACTERIZATION_TEST(
|
||||
WorkerProtoTest,
|
||||
buildResult_1_27,
|
||||
"build-result-1.27",
|
||||
1 << 8 | 27,
|
||||
({
|
||||
WorkerProtoTest, buildResult_1_28, "build-result-1.28", 1 << 8 | 28, ({
|
||||
using namespace std::literals::chrono_literals;
|
||||
std::tuple<BuildResult, BuildResult, BuildResult> t {
|
||||
BuildResult {
|
||||
std::tuple<BuildResult, BuildResult, BuildResult> t{
|
||||
BuildResult{
|
||||
.status = BuildResult::OutputRejected,
|
||||
.errorMsg = "no idea why",
|
||||
},
|
||||
BuildResult {
|
||||
BuildResult{
|
||||
.status = BuildResult::NotDeterministic,
|
||||
.errorMsg = "no idea why",
|
||||
},
|
||||
BuildResult {
|
||||
BuildResult{
|
||||
.status = BuildResult::Built,
|
||||
.builtOutputs =
|
||||
{
|
||||
{
|
||||
"foo",
|
||||
{
|
||||
.id =
|
||||
DrvOutput{
|
||||
.drvHash =
|
||||
Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "foo",
|
||||
},
|
||||
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
|
||||
},
|
||||
},
|
||||
{
|
||||
"bar",
|
||||
{
|
||||
.id =
|
||||
DrvOutput{
|
||||
.drvHash =
|
||||
Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "bar",
|
||||
},
|
||||
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
t;
|
||||
}))
|
||||
|
||||
VERSIONED_CHARACTERIZATION_TEST(
|
||||
WorkerProtoTest,
|
||||
buildResult_1_28,
|
||||
"build-result-1.28",
|
||||
1 << 8 | 28,
|
||||
({
|
||||
WorkerProtoTest, buildResult_1_29, "build-result-1.29", 1 << 8 | 29, ({
|
||||
using namespace std::literals::chrono_literals;
|
||||
std::tuple<BuildResult, BuildResult, BuildResult> t {
|
||||
BuildResult {
|
||||
std::tuple<BuildResult, BuildResult, BuildResult> t{
|
||||
BuildResult{
|
||||
.status = BuildResult::OutputRejected,
|
||||
.errorMsg = "no idea why",
|
||||
},
|
||||
BuildResult {
|
||||
.status = BuildResult::NotDeterministic,
|
||||
.errorMsg = "no idea why",
|
||||
},
|
||||
BuildResult {
|
||||
.status = BuildResult::Built,
|
||||
.builtOutputs = {
|
||||
{
|
||||
"foo",
|
||||
{
|
||||
.id = DrvOutput {
|
||||
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "foo",
|
||||
},
|
||||
.outPath = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"bar",
|
||||
{
|
||||
.id = DrvOutput {
|
||||
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "bar",
|
||||
},
|
||||
.outPath = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
t;
|
||||
}))
|
||||
|
||||
VERSIONED_CHARACTERIZATION_TEST(
|
||||
WorkerProtoTest,
|
||||
buildResult_1_29,
|
||||
"build-result-1.29",
|
||||
1 << 8 | 29,
|
||||
({
|
||||
using namespace std::literals::chrono_literals;
|
||||
std::tuple<BuildResult, BuildResult, BuildResult> t {
|
||||
BuildResult {
|
||||
.status = BuildResult::OutputRejected,
|
||||
.errorMsg = "no idea why",
|
||||
},
|
||||
BuildResult {
|
||||
BuildResult{
|
||||
.status = BuildResult::NotDeterministic,
|
||||
.errorMsg = "no idea why",
|
||||
.timesBuilt = 3,
|
||||
|
|
@ -259,31 +257,36 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
.startTime = 30,
|
||||
.stopTime = 50,
|
||||
},
|
||||
BuildResult {
|
||||
BuildResult{
|
||||
.status = BuildResult::Built,
|
||||
.timesBuilt = 1,
|
||||
.builtOutputs = {
|
||||
.builtOutputs =
|
||||
{
|
||||
"foo",
|
||||
{
|
||||
.id = DrvOutput {
|
||||
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "foo",
|
||||
"foo",
|
||||
{
|
||||
.id =
|
||||
DrvOutput{
|
||||
.drvHash =
|
||||
Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "foo",
|
||||
},
|
||||
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
|
||||
},
|
||||
},
|
||||
{
|
||||
"bar",
|
||||
{
|
||||
.id =
|
||||
DrvOutput{
|
||||
.drvHash =
|
||||
Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "bar",
|
||||
},
|
||||
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar"},
|
||||
},
|
||||
.outPath = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"bar",
|
||||
{
|
||||
.id = DrvOutput {
|
||||
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "bar",
|
||||
},
|
||||
.outPath = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar" },
|
||||
},
|
||||
},
|
||||
},
|
||||
.startTime = 30,
|
||||
.stopTime = 50,
|
||||
},
|
||||
|
|
@ -292,18 +295,14 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
}))
|
||||
|
||||
VERSIONED_CHARACTERIZATION_TEST(
|
||||
WorkerProtoTest,
|
||||
buildResult_1_37,
|
||||
"build-result-1.37",
|
||||
1 << 8 | 37,
|
||||
({
|
||||
WorkerProtoTest, buildResult_1_37, "build-result-1.37", 1 << 8 | 37, ({
|
||||
using namespace std::literals::chrono_literals;
|
||||
std::tuple<BuildResult, BuildResult, BuildResult> t {
|
||||
BuildResult {
|
||||
std::tuple<BuildResult, BuildResult, BuildResult> t{
|
||||
BuildResult{
|
||||
.status = BuildResult::OutputRejected,
|
||||
.errorMsg = "no idea why",
|
||||
},
|
||||
BuildResult {
|
||||
BuildResult{
|
||||
.status = BuildResult::NotDeterministic,
|
||||
.errorMsg = "no idea why",
|
||||
.timesBuilt = 3,
|
||||
|
|
@ -311,31 +310,36 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
.startTime = 30,
|
||||
.stopTime = 50,
|
||||
},
|
||||
BuildResult {
|
||||
BuildResult{
|
||||
.status = BuildResult::Built,
|
||||
.timesBuilt = 1,
|
||||
.builtOutputs = {
|
||||
.builtOutputs =
|
||||
{
|
||||
"foo",
|
||||
{
|
||||
.id = DrvOutput {
|
||||
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "foo",
|
||||
"foo",
|
||||
{
|
||||
.id =
|
||||
DrvOutput{
|
||||
.drvHash =
|
||||
Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "foo",
|
||||
},
|
||||
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
|
||||
},
|
||||
},
|
||||
{
|
||||
"bar",
|
||||
{
|
||||
.id =
|
||||
DrvOutput{
|
||||
.drvHash =
|
||||
Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "bar",
|
||||
},
|
||||
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar"},
|
||||
},
|
||||
.outPath = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"bar",
|
||||
{
|
||||
.id = DrvOutput {
|
||||
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
|
||||
.outputName = "bar",
|
||||
},
|
||||
.outPath = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar" },
|
||||
},
|
||||
},
|
||||
},
|
||||
.startTime = 30,
|
||||
.stopTime = 50,
|
||||
.cpuUser = std::chrono::microseconds(500s),
|
||||
|
|
@ -345,51 +349,49 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
t;
|
||||
}))
|
||||
|
||||
VERSIONED_CHARACTERIZATION_TEST(
|
||||
WorkerProtoTest,
|
||||
keyedBuildResult_1_29,
|
||||
"keyed-build-result-1.29",
|
||||
1 << 8 | 29,
|
||||
({
|
||||
using namespace std::literals::chrono_literals;
|
||||
std::tuple<KeyedBuildResult, KeyedBuildResult/*, KeyedBuildResult*/> t {
|
||||
KeyedBuildResult {
|
||||
{
|
||||
.status = KeyedBuildResult::OutputRejected,
|
||||
.errorMsg = "no idea why",
|
||||
},
|
||||
/* .path = */ DerivedPath::Opaque {
|
||||
StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-xxx" },
|
||||
},
|
||||
},
|
||||
KeyedBuildResult {
|
||||
{
|
||||
.status = KeyedBuildResult::NotDeterministic,
|
||||
.errorMsg = "no idea why",
|
||||
.timesBuilt = 3,
|
||||
.isNonDeterministic = true,
|
||||
.startTime = 30,
|
||||
.stopTime = 50,
|
||||
},
|
||||
/* .path = */ DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(StorePath {
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::Names { "out" },
|
||||
},
|
||||
},
|
||||
};
|
||||
t;
|
||||
}))
|
||||
VERSIONED_CHARACTERIZATION_TEST(WorkerProtoTest, keyedBuildResult_1_29, "keyed-build-result-1.29", 1 << 8 | 29, ({
|
||||
using namespace std::literals::chrono_literals;
|
||||
std::tuple<KeyedBuildResult, KeyedBuildResult /*, KeyedBuildResult*/> t{
|
||||
KeyedBuildResult{
|
||||
{
|
||||
.status = KeyedBuildResult::OutputRejected,
|
||||
.errorMsg = "no idea why",
|
||||
},
|
||||
/* .path = */
|
||||
DerivedPath::Opaque{
|
||||
StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-xxx"},
|
||||
},
|
||||
},
|
||||
KeyedBuildResult{
|
||||
{
|
||||
.status = KeyedBuildResult::NotDeterministic,
|
||||
.errorMsg = "no idea why",
|
||||
.timesBuilt = 3,
|
||||
.isNonDeterministic = true,
|
||||
.startTime = 30,
|
||||
.stopTime = 50,
|
||||
},
|
||||
/* .path = */
|
||||
DerivedPath::Built{
|
||||
.drvPath = makeConstantStorePathRef(
|
||||
StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::Names{"out"},
|
||||
},
|
||||
},
|
||||
};
|
||||
t;
|
||||
}))
|
||||
|
||||
VERSIONED_CHARACTERIZATION_TEST(
|
||||
WorkerProtoTest,
|
||||
unkeyedValidPathInfo_1_15,
|
||||
"unkeyed-valid-path-info-1.15",
|
||||
1 << 8 | 15,
|
||||
(std::tuple<UnkeyedValidPathInfo, UnkeyedValidPathInfo> {
|
||||
(std::tuple<UnkeyedValidPathInfo, UnkeyedValidPathInfo>{
|
||||
({
|
||||
UnkeyedValidPathInfo info {
|
||||
UnkeyedValidPathInfo info{
|
||||
Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
||||
};
|
||||
info.registrationTime = 23423;
|
||||
|
|
@ -397,14 +399,14 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
info;
|
||||
}),
|
||||
({
|
||||
UnkeyedValidPathInfo info {
|
||||
UnkeyedValidPathInfo info{
|
||||
Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
||||
};
|
||||
info.deriver = StorePath {
|
||||
info.deriver = StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
};
|
||||
info.references = {
|
||||
StorePath {
|
||||
StorePath{
|
||||
"g1w7hyyyy1w7hy3qg1w7hy3qgqqqqy3q-foo.drv",
|
||||
},
|
||||
};
|
||||
|
|
@ -419,13 +421,13 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
validPathInfo_1_15,
|
||||
"valid-path-info-1.15",
|
||||
1 << 8 | 15,
|
||||
(std::tuple<ValidPathInfo, ValidPathInfo> {
|
||||
(std::tuple<ValidPathInfo, ValidPathInfo>{
|
||||
({
|
||||
ValidPathInfo info {
|
||||
StorePath {
|
||||
ValidPathInfo info{
|
||||
StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
|
||||
},
|
||||
UnkeyedValidPathInfo {
|
||||
UnkeyedValidPathInfo{
|
||||
Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
||||
},
|
||||
};
|
||||
|
|
@ -434,24 +436,24 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
info;
|
||||
}),
|
||||
({
|
||||
ValidPathInfo info {
|
||||
StorePath {
|
||||
ValidPathInfo info{
|
||||
StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
|
||||
},
|
||||
UnkeyedValidPathInfo {
|
||||
UnkeyedValidPathInfo{
|
||||
Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
||||
},
|
||||
};
|
||||
info.deriver = StorePath {
|
||||
info.deriver = StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
};
|
||||
info.references = {
|
||||
// other reference
|
||||
StorePath {
|
||||
StorePath{
|
||||
"g1w7hyyyy1w7hy3qg1w7hy3qgqqqqy3q-foo",
|
||||
},
|
||||
// self reference
|
||||
StorePath {
|
||||
StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
|
||||
},
|
||||
};
|
||||
|
|
@ -466,13 +468,13 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
validPathInfo_1_16,
|
||||
"valid-path-info-1.16",
|
||||
1 << 8 | 16,
|
||||
(std::tuple<ValidPathInfo, ValidPathInfo, ValidPathInfo> {
|
||||
(std::tuple<ValidPathInfo, ValidPathInfo, ValidPathInfo>{
|
||||
({
|
||||
ValidPathInfo info {
|
||||
StorePath {
|
||||
ValidPathInfo info{
|
||||
StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
|
||||
},
|
||||
UnkeyedValidPathInfo {
|
||||
UnkeyedValidPathInfo{
|
||||
Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
||||
},
|
||||
};
|
||||
|
|
@ -482,50 +484,53 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
info;
|
||||
}),
|
||||
({
|
||||
ValidPathInfo info {
|
||||
StorePath {
|
||||
ValidPathInfo info{
|
||||
StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
|
||||
},
|
||||
UnkeyedValidPathInfo {
|
||||
UnkeyedValidPathInfo{
|
||||
Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
||||
},
|
||||
};
|
||||
info.deriver = StorePath {
|
||||
info.deriver = StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
};
|
||||
info.references = {
|
||||
// other reference
|
||||
StorePath {
|
||||
StorePath{
|
||||
"g1w7hyyyy1w7hy3qg1w7hy3qgqqqqy3q-foo",
|
||||
},
|
||||
// self reference
|
||||
StorePath {
|
||||
StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
|
||||
},
|
||||
};
|
||||
info.registrationTime = 23423;
|
||||
info.narSize = 34878;
|
||||
info.sigs = {
|
||||
"fake-sig-1",
|
||||
"fake-sig-2",
|
||||
},
|
||||
info.sigs =
|
||||
{
|
||||
"fake-sig-1",
|
||||
"fake-sig-2",
|
||||
},
|
||||
info;
|
||||
}),
|
||||
({
|
||||
ValidPathInfo info {
|
||||
ValidPathInfo info{
|
||||
*LibStoreTest::store,
|
||||
"foo",
|
||||
FixedOutputInfo {
|
||||
FixedOutputInfo{
|
||||
.method = FileIngestionMethod::NixArchive,
|
||||
.hash = hashString(HashAlgorithm::SHA256, "(...)"),
|
||||
.references = {
|
||||
.others = {
|
||||
StorePath {
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
|
||||
},
|
||||
.references =
|
||||
{
|
||||
.others =
|
||||
{
|
||||
StorePath{
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar",
|
||||
},
|
||||
},
|
||||
.self = true,
|
||||
},
|
||||
.self = true,
|
||||
},
|
||||
},
|
||||
Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),
|
||||
};
|
||||
|
|
@ -540,7 +545,7 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
buildMode,
|
||||
"build-mode",
|
||||
defaultVersion,
|
||||
(std::tuple<BuildMode, BuildMode, BuildMode> {
|
||||
(std::tuple<BuildMode, BuildMode, BuildMode>{
|
||||
bmNormal,
|
||||
bmRepair,
|
||||
bmCheck,
|
||||
|
|
@ -551,10 +556,10 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
optionalTrustedFlag,
|
||||
"optional-trusted-flag",
|
||||
defaultVersion,
|
||||
(std::tuple<std::optional<TrustedFlag>, std::optional<TrustedFlag>, std::optional<TrustedFlag>> {
|
||||
(std::tuple<std::optional<TrustedFlag>, std::optional<TrustedFlag>, std::optional<TrustedFlag>>{
|
||||
std::nullopt,
|
||||
std::optional { Trusted },
|
||||
std::optional { NotTrusted },
|
||||
std::optional{Trusted},
|
||||
std::optional{NotTrusted},
|
||||
}))
|
||||
|
||||
VERSIONED_CHARACTERIZATION_TEST(
|
||||
|
|
@ -562,11 +567,15 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
vector,
|
||||
"vector",
|
||||
defaultVersion,
|
||||
(std::tuple<std::vector<std::string>, std::vector<std::string>, std::vector<std::string>, std::vector<std::vector<std::string>>> {
|
||||
{ },
|
||||
{ "" },
|
||||
{ "", "foo", "bar" },
|
||||
{ {}, { "" }, { "", "1", "2" } },
|
||||
(std::tuple<
|
||||
std::vector<std::string>,
|
||||
std::vector<std::string>,
|
||||
std::vector<std::string>,
|
||||
std::vector<std::vector<std::string>>>{
|
||||
{},
|
||||
{""},
|
||||
{"", "foo", "bar"},
|
||||
{{}, {""}, {"", "1", "2"}},
|
||||
}))
|
||||
|
||||
VERSIONED_CHARACTERIZATION_TEST(
|
||||
|
|
@ -574,11 +583,11 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
set,
|
||||
"set",
|
||||
defaultVersion,
|
||||
(std::tuple<StringSet, StringSet, StringSet, std::set<StringSet>> {
|
||||
{ },
|
||||
{ "" },
|
||||
{ "", "foo", "bar" },
|
||||
{ {}, { "" }, { "", "1", "2" } },
|
||||
(std::tuple<StringSet, StringSet, StringSet, std::set<StringSet>>{
|
||||
{},
|
||||
{""},
|
||||
{"", "foo", "bar"},
|
||||
{{}, {""}, {"", "1", "2"}},
|
||||
}))
|
||||
|
||||
VERSIONED_CHARACTERIZATION_TEST(
|
||||
|
|
@ -586,10 +595,10 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
optionalStorePath,
|
||||
"optional-store-path",
|
||||
defaultVersion,
|
||||
(std::tuple<std::optional<StorePath>, std::optional<StorePath>> {
|
||||
(std::tuple<std::optional<StorePath>, std::optional<StorePath>>{
|
||||
std::nullopt,
|
||||
std::optional {
|
||||
StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo-bar" },
|
||||
std::optional{
|
||||
StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo-bar"},
|
||||
},
|
||||
}))
|
||||
|
||||
|
|
@ -598,10 +607,10 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
optionalContentAddress,
|
||||
"optional-content-address",
|
||||
defaultVersion,
|
||||
(std::tuple<std::optional<ContentAddress>, std::optional<ContentAddress>> {
|
||||
(std::tuple<std::optional<ContentAddress>, std::optional<ContentAddress>>{
|
||||
std::nullopt,
|
||||
std::optional {
|
||||
ContentAddress {
|
||||
std::optional{
|
||||
ContentAddress{
|
||||
.method = ContentAddressMethod::Raw::Flat,
|
||||
.hash = hashString(HashAlgorithm::SHA1, "blob blob..."),
|
||||
},
|
||||
|
|
@ -613,7 +622,7 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
clientHandshakeInfo_1_30,
|
||||
"client-handshake-info_1_30",
|
||||
1 << 8 | 30,
|
||||
(std::tuple<WorkerProto::ClientHandshakeInfo> {
|
||||
(std::tuple<WorkerProto::ClientHandshakeInfo>{
|
||||
{},
|
||||
}))
|
||||
|
||||
|
|
@ -622,12 +631,12 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
clientHandshakeInfo_1_33,
|
||||
"client-handshake-info_1_33",
|
||||
1 << 8 | 33,
|
||||
(std::tuple<WorkerProto::ClientHandshakeInfo, WorkerProto::ClientHandshakeInfo> {
|
||||
(std::tuple<WorkerProto::ClientHandshakeInfo, WorkerProto::ClientHandshakeInfo>{
|
||||
{
|
||||
.daemonNixVersion = std::optional { "foo" },
|
||||
.daemonNixVersion = std::optional{"foo"},
|
||||
},
|
||||
{
|
||||
.daemonNixVersion = std::optional { "bar" },
|
||||
.daemonNixVersion = std::optional{"bar"},
|
||||
},
|
||||
}))
|
||||
|
||||
|
|
@ -636,14 +645,14 @@ VERSIONED_CHARACTERIZATION_TEST(
|
|||
clientHandshakeInfo_1_35,
|
||||
"client-handshake-info_1_35",
|
||||
1 << 8 | 35,
|
||||
(std::tuple<WorkerProto::ClientHandshakeInfo, WorkerProto::ClientHandshakeInfo> {
|
||||
(std::tuple<WorkerProto::ClientHandshakeInfo, WorkerProto::ClientHandshakeInfo>{
|
||||
{
|
||||
.daemonNixVersion = std::optional { "foo" },
|
||||
.remoteTrustsUs = std::optional { NotTrusted },
|
||||
.daemonNixVersion = std::optional{"foo"},
|
||||
.remoteTrustsUs = std::optional{NotTrusted},
|
||||
},
|
||||
{
|
||||
.daemonNixVersion = std::optional { "bar" },
|
||||
.remoteTrustsUs = std::optional { Trusted },
|
||||
.daemonNixVersion = std::optional{"bar"},
|
||||
.remoteTrustsUs = std::optional{Trusted},
|
||||
},
|
||||
}))
|
||||
|
||||
|
|
@ -659,18 +668,16 @@ TEST_F(WorkerProtoTest, handshake_log)
|
|||
WorkerProto::Version clientResult;
|
||||
|
||||
auto thread = std::thread([&]() {
|
||||
FdSink out { toServer.writeSide.get() };
|
||||
FdSource in0 { toClient.readSide.get() };
|
||||
TeeSource in { in0, toClientLog };
|
||||
clientResult = std::get<0>(WorkerProto::BasicClientConnection::handshake(
|
||||
out, in, defaultVersion, {}));
|
||||
FdSink out{toServer.writeSide.get()};
|
||||
FdSource in0{toClient.readSide.get()};
|
||||
TeeSource in{in0, toClientLog};
|
||||
clientResult = std::get<0>(WorkerProto::BasicClientConnection::handshake(out, in, defaultVersion, {}));
|
||||
});
|
||||
|
||||
{
|
||||
FdSink out { toClient.writeSide.get() };
|
||||
FdSource in { toServer.readSide.get() };
|
||||
WorkerProto::BasicServerConnection::handshake(
|
||||
out, in, defaultVersion, {});
|
||||
FdSink out{toClient.writeSide.get()};
|
||||
FdSource in{toServer.readSide.get()};
|
||||
WorkerProto::BasicServerConnection::handshake(out, in, defaultVersion, {});
|
||||
};
|
||||
|
||||
thread.join();
|
||||
|
|
@ -688,16 +695,14 @@ TEST_F(WorkerProtoTest, handshake_features)
|
|||
std::tuple<WorkerProto::Version, WorkerProto::FeatureSet> clientResult;
|
||||
|
||||
auto clientThread = std::thread([&]() {
|
||||
FdSink out { toServer.writeSide.get() };
|
||||
FdSource in { toClient.readSide.get() };
|
||||
clientResult = WorkerProto::BasicClientConnection::handshake(
|
||||
out, in, 123, {"bar", "aap", "mies", "xyzzy"});
|
||||
FdSink out{toServer.writeSide.get()};
|
||||
FdSource in{toClient.readSide.get()};
|
||||
clientResult = WorkerProto::BasicClientConnection::handshake(out, in, 123, {"bar", "aap", "mies", "xyzzy"});
|
||||
});
|
||||
|
||||
FdSink out { toClient.writeSide.get() };
|
||||
FdSource in { toServer.readSide.get() };
|
||||
auto daemonResult = WorkerProto::BasicServerConnection::handshake(
|
||||
out, in, 456, {"foo", "bar", "xyzzy"});
|
||||
FdSink out{toClient.writeSide.get()};
|
||||
FdSource in{toServer.readSide.get()};
|
||||
auto daemonResult = WorkerProto::BasicServerConnection::handshake(out, in, 456, {"foo", "bar", "xyzzy"});
|
||||
|
||||
clientThread.join();
|
||||
|
||||
|
|
@ -707,8 +712,9 @@ TEST_F(WorkerProtoTest, handshake_features)
|
|||
}
|
||||
|
||||
/// Has to be a `BufferedSink` for handshake.
|
||||
struct NullBufferedSink : BufferedSink {
|
||||
void writeUnbuffered(std::string_view data) override { }
|
||||
struct NullBufferedSink : BufferedSink
|
||||
{
|
||||
void writeUnbuffered(std::string_view data) override {}
|
||||
};
|
||||
|
||||
TEST_F(WorkerProtoTest, handshake_client_replay)
|
||||
|
|
@ -716,9 +722,9 @@ TEST_F(WorkerProtoTest, handshake_client_replay)
|
|||
CharacterizationTest::readTest("handshake-to-client", [&](std::string toClientLog) {
|
||||
NullBufferedSink nullSink;
|
||||
|
||||
StringSource in { toClientLog };
|
||||
auto clientResult = std::get<0>(WorkerProto::BasicClientConnection::handshake(
|
||||
nullSink, in, defaultVersion, {}));
|
||||
StringSource in{toClientLog};
|
||||
auto clientResult =
|
||||
std::get<0>(WorkerProto::BasicClientConnection::handshake(nullSink, in, defaultVersion, {}));
|
||||
|
||||
EXPECT_EQ(clientResult, defaultVersion);
|
||||
});
|
||||
|
|
@ -752,23 +758,18 @@ TEST_F(WorkerProtoTest, handshake_client_corrupted_throws)
|
|||
++toClientLogCorrupt[idx];
|
||||
|
||||
NullBufferedSink nullSink;
|
||||
StringSource in { toClientLogCorrupt };
|
||||
StringSource in{toClientLogCorrupt};
|
||||
|
||||
if (idx < 4 || idx == 9) {
|
||||
// magic bytes don't match
|
||||
EXPECT_THROW(
|
||||
WorkerProto::BasicClientConnection::handshake(
|
||||
nullSink, in, defaultVersion, {}),
|
||||
Error);
|
||||
EXPECT_THROW(WorkerProto::BasicClientConnection::handshake(nullSink, in, defaultVersion, {}), Error);
|
||||
} else if (idx < 8 || idx >= 12) {
|
||||
// Number out of bounds
|
||||
EXPECT_THROW(
|
||||
WorkerProto::BasicClientConnection::handshake(
|
||||
nullSink, in, defaultVersion, {}),
|
||||
WorkerProto::BasicClientConnection::handshake(nullSink, in, defaultVersion, {}),
|
||||
SerialisationError);
|
||||
} else {
|
||||
auto ver = std::get<0>(WorkerProto::BasicClientConnection::handshake(
|
||||
nullSink, in, defaultVersion, {}));
|
||||
auto ver = std::get<0>(WorkerProto::BasicClientConnection::handshake(nullSink, in, defaultVersion, {}));
|
||||
// `std::min` of this and the other version saves us
|
||||
EXPECT_EQ(ver, defaultVersion);
|
||||
}
|
||||
|
|
@ -776,4 +777,4 @@ TEST_F(WorkerProtoTest, handshake_client_corrupted_throws)
|
|||
});
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue