@@ -13,7 +13,6 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
1313 import opened Wrappers
1414 import opened StandardLibrary
1515 import opened StandardLibrary. UInt
16- import opened StandardLibrary. String
1716 import JSON. API
1817 import opened JSON. Values
1918 import JSON. Errors
@@ -46,7 +45,9 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
4645 import TransOp = AwsCryptographyDbEncryptionSdkDynamoDbTransformsOperations
4746 import DdbMiddlewareConfig
4847 import DynamoDbEncryptionTransforms
48+ import OsLang
4949
50+ const PerfIterations : uint32 := 1000
5051
5152 datatype TestVectorConfig = TestVectorConfig (
5253 schemaOnEncrypt : DDB .CreateTableInput,
@@ -73,60 +74,60 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
7374 modifies keyVectors. Modifies
7475 ensures keyVectors. ValidState ()
7576 {
76- print "DBE Test Vectors\n";
77- print |globalRecords|, " records. \n";
78- print |tableEncryptionConfigs|, " tableEncryptionConfigs. \n";
79- print |largeEncryptionConfigs|, " largeEncryptionConfigs. \n";
80- print |queries|, " queries. \n";
81- print |names|, " names. \n";
82- print |values|, " values. \n";
83- print |failingQueries|, " failingQueries. \n";
84- print |complexTests|, " complexTests. \n";
85- print |ioTests|, " ioTests. \n";
86- print |configsForIoTest|, " configsForIoTest. \n";
87- print |configsForModTest|, " configsForModTest. \n";
88- print |strings|, " strings. \n";
89- print |large|, " large. \n";
90- if |roundTripTests| != 0 {
91- print |roundTripTests[0]. configs|, " configs and ", |roundTripTests[0]. records|, " records for round trip. \n";
92- }
93- if |roundTripTests| > 1 {
94- print |roundTripTests[1]. configs|, " configs and ", |roundTripTests[1]. records|, " records for round trip. \n";
95- }
96-
97- var _ :- expect DecryptManifest. Decrypt ("decrypt_dotnet_32.json", keyVectors);
98- var _ :- expect DecryptManifest. Decrypt ("decrypt_java_32.json", keyVectors);
99- var _ :- expect DecryptManifest. Decrypt ("decrypt_dotnet_33.json", keyVectors);
100- var _ :- expect DecryptManifest. Decrypt ("decrypt_java_33.json", keyVectors);
101- var _ :- expect DecryptManifest. Decrypt ("decrypt_dotnet_33a.json", keyVectors);
102- var _ :- expect DecryptManifest. Decrypt ("decrypt_java_33a.json", keyVectors);
103- var _ :- expect DecryptManifest. Decrypt ("decrypt_rust_38.json", keyVectors);
104- var _ :- expect WriteManifest. Write ("encrypt.json");
105- var _ :- expect EncryptManifest. Encrypt ("encrypt.json", "decrypt.json", "java", "3.3", keyVectors);
106- var _ :- expect DecryptManifest. Decrypt ("decrypt.json", keyVectors);
107- if |globalRecords| + |tableEncryptionConfigs| + |queries| == 0 {
108- print "\nRunning no tests\n";
109- return ;
110- }
111- Validate ();
112- // Because of Dafny-Rust's lack of modules, there is no way to mae an interceptor for the wrapped DB-ESDK client.
113- // So we create runtimes/rust/SkipLocal.txt to skip those tests that need the wrapped client.
114- var skipLocal := FileIO. ReadBytesFromFile ("SkipLocal.txt");
115- if skipLocal. Success? {
116- return ;
117- }
118- StringOrdering ();
77+ // print "DBE Test Vectors\n";
78+ // print |globalRecords|, " records.\n";
79+ // print |tableEncryptionConfigs|, " tableEncryptionConfigs.\n";
80+ // print |largeEncryptionConfigs|, " largeEncryptionConfigs.\n";
81+ // print |queries|, " queries.\n";
82+ // print |names|, " names.\n";
83+ // print |values|, " values.\n";
84+ // print |failingQueries|, " failingQueries.\n";
85+ // print |complexTests|, " complexTests.\n";
86+ // print |ioTests|, " ioTests.\n";
87+ // print |configsForIoTest|, " configsForIoTest.\n";
88+ // print |configsForModTest|, " configsForModTest.\n";
89+ // print |strings|, " strings.\n";
90+ // print |large|, " large.\n";
91+ // if |roundTripTests| != 0 {
92+ // print |roundTripTests[0].configs|, " configs and ", |roundTripTests[0].records|, " records for round trip.\n";
93+ // }
94+ // if |roundTripTests| > 1 {
95+ // print |roundTripTests[1].configs|, " configs and ", |roundTripTests[1].records|, " records for round trip.\n";
96+ // }
97+
98+ // var _ :- expect DecryptManifest.Decrypt("decrypt_dotnet_32.json", keyVectors);
99+ // var _ :- expect DecryptManifest.Decrypt("decrypt_java_32.json", keyVectors);
100+ // var _ :- expect DecryptManifest.Decrypt("decrypt_dotnet_33.json", keyVectors);
101+ // var _ :- expect DecryptManifest.Decrypt("decrypt_java_33.json", keyVectors);
102+ // var _ :- expect DecryptManifest.Decrypt("decrypt_dotnet_33a.json", keyVectors);
103+ // var _ :- expect DecryptManifest.Decrypt("decrypt_java_33a.json", keyVectors);
104+ // var _ :- expect DecryptManifest.Decrypt("decrypt_rust_38.json", keyVectors);
105+ // var _ :- expect WriteManifest.Write("encrypt.json");
106+ // var _ :- expect EncryptManifest.Encrypt("encrypt.json", "decrypt.json", "java", "3.3", keyVectors);
107+ // var _ :- expect DecryptManifest.Decrypt("decrypt.json", keyVectors);
108+ // if |globalRecords| + |tableEncryptionConfigs| + |queries| == 0 {
109+ // print "\nRunning no tests\n";
110+ // return;
111+ // }
112+ // Validate();
113+ // // Because of Dafny-Rust's lack of modules, there is no way to make an interceptor for the wrapped DB-ESDK client.
114+ // // So we create runtimes/rust/SkipLocal.txt to skip those tests that need the wrapped client.
115+ // var skipLocal := FileIO.ReadBytesFromFile("SkipLocal.txt");
116+ // if skipLocal.Success? {
117+ // return;
118+ // }
119+ // StringOrdering();
119120 LargeTests ();
120- BasicIoTest ();
121- RunIoTests ();
122- BasicQueryTest ();
123- ConfigModTest ();
124- ComplexTests ();
125- WriteTests ();
126- RoundTripTests ();
127- DecryptTests ();
128- var client :- expect CreateInterceptedDDBClient. CreateVanillaDDBClient ();
129- DeleteTable (client);
121+ // BasicIoTest();
122+ // RunIoTests();
123+ // BasicQueryTest();
124+ // ConfigModTest();
125+ // ComplexTests();
126+ // WriteTests();
127+ // RoundTripTests();
128+ // DecryptTests();
129+ // var client :- expect CreateInterceptedDDBClient.CreateVanillaDDBClient();
130+ // DeleteTable(client);
130131 }
131132
132133 function NewOrderRecord (i : nat , str : string ) : Record
@@ -494,8 +495,8 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
494495 }
495496 }
496497
497- const TestConfigs : set < string > := {"all "}
498- const TestRecords : set < string > := {"all "}
498+ const TestConfigs : set < string > := {"full_sign_nosign "}
499+ const TestRecords : set < string > := {"flat "}
499500
500501 predicate DoTestConfig (name : string )
501502 {
@@ -554,25 +555,23 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
554555 }
555556
556557 var time := Time. GetAbsoluteTime ();
557- for i := 0 to record . count {
558+ for i : uint32 : = 0 to PerfIterations {
558559 var put_input_input := Trans. PutItemInputTransformInput ( sdkInput := DDB.PutItemInput (TableName := TableName, Item := record.item));
559560 var put_input_output :- expect client. PutItemInputTransform (put_input_input);
560561 }
561- var elapsed := Time. TimeSince (time);
562- Time. PrintTimeLong (elapsed, "Large Encrypt " + record.name + "(" + Base10Int2String(record.count) + ") " + config);
562+ Time. PrintTimeSinceLong (time, "Large Encrypt " + record.name + config, DecryptManifest.LogFileName());
563563
564564 var put_input_input := Trans. PutItemInputTransformInput ( sdkInput := DDB.PutItemInput (TableName := TableName, Item := record.item));
565565 var put_input_output :- expect client. PutItemInputTransform (put_input_input);
566566 time := Time. GetAbsoluteTime ();
567- for i := 0 to record . count {
567+ for i : uint32 : = 0 to PerfIterations {
568568 var orig_get_input := DDB. GetItemInput (TableName := TableName, Key := map[]);
569569 var get_output := DDB. GetItemOutput (Item := Some(put_input_output.transformedInput.Item));
570570 var trans_get_input := Trans. GetItemOutputTransformInput (sdkOutput := get_output, originalInput := orig_get_input);
571571 var put_output :- expect client. GetItemOutputTransform (trans_get_input);
572572
573573 }
574- elapsed := Time. TimeSince (time);
575- Time. PrintTimeLong (elapsed, "Large Decrypt " + record.name + "(" + Base10Int2String(record.count) + ") " + config);
574+ Time. PrintTimeSinceLong (time, "Large Decrypt " + record.name + config, DecryptManifest.LogFileName());
576575 }
577576
578577 method RoundTripTests ()
0 commit comments