@@ -13,7 +13,6 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
13
13
import opened Wrappers
14
14
import opened StandardLibrary
15
15
import opened StandardLibrary. UInt
16
- import opened StandardLibrary. String
17
16
import JSON. API
18
17
import opened JSON. Values
19
18
import JSON. Errors
@@ -46,7 +45,9 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
46
45
import TransOp = AwsCryptographyDbEncryptionSdkDynamoDbTransformsOperations
47
46
import DdbMiddlewareConfig
48
47
import DynamoDbEncryptionTransforms
48
+ import OsLang
49
49
50
+ const PerfIterations : uint32 := 1000
50
51
51
52
datatype TestVectorConfig = TestVectorConfig (
52
53
schemaOnEncrypt : DDB .CreateTableInput,
@@ -73,60 +74,60 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
73
74
modifies keyVectors. Modifies
74
75
ensures keyVectors. ValidState ()
75
76
{
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();
119
120
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);
130
131
}
131
132
132
133
function NewOrderRecord (i : nat , str : string ) : Record
@@ -494,8 +495,8 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
494
495
}
495
496
}
496
497
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 "}
499
500
500
501
predicate DoTestConfig (name : string )
501
502
{
@@ -554,25 +555,23 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
554
555
}
555
556
556
557
var time := Time. GetAbsoluteTime ();
557
- for i := 0 to record . count {
558
+ for i : uint32 : = 0 to PerfIterations {
558
559
var put_input_input := Trans. PutItemInputTransformInput ( sdkInput := DDB.PutItemInput (TableName := TableName, Item := record.item));
559
560
var put_input_output :- expect client. PutItemInputTransform (put_input_input);
560
561
}
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());
563
563
564
564
var put_input_input := Trans. PutItemInputTransformInput ( sdkInput := DDB.PutItemInput (TableName := TableName, Item := record.item));
565
565
var put_input_output :- expect client. PutItemInputTransform (put_input_input);
566
566
time := Time. GetAbsoluteTime ();
567
- for i := 0 to record . count {
567
+ for i : uint32 : = 0 to PerfIterations {
568
568
var orig_get_input := DDB. GetItemInput (TableName := TableName, Key := map[]);
569
569
var get_output := DDB. GetItemOutput (Item := Some(put_input_output.transformedInput.Item));
570
570
var trans_get_input := Trans. GetItemOutputTransformInput (sdkOutput := get_output, originalInput := orig_get_input);
571
571
var put_output :- expect client. GetItemOutputTransform (trans_get_input);
572
572
573
573
}
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());
576
575
}
577
576
578
577
method RoundTripTests ()
0 commit comments