-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
definitions.schema.json
784 lines (783 loc) · 24.7 KB
/
definitions.schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
{
"$id": "definitions.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "JSON Schema Definitions File. ",
"description": "This file is used for declaring definitions that are referenced from other schemas",
"definitions": {
"list_of_strings": {
"type": "array",
"uniqueItems": true,
"minItems": 1,
"items": {
"type": "string"
}
},
"string_or_list": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/list_of_strings"
}
]
},
"list_of_ints": {
"type": "array",
"uniqueItems": true,
"minItems": 1,
"items": {
"type": "integer"
}
},
"list_of_positive_integers": {
"type": "array",
"uniqueItems": true,
"minItems": 1,
"items": {
"type": "integer",
"minimum": 1
}
},
"int_or_list": {
"oneOf": [
{
"type": "integer"
},
{
"$ref": "#/definitions/list_of_ints"
}
]
},
"file": {
"type": "string",
"description": "Specify a file name to read"
},
"file_regex": {
"type": "array",
"description": "Specify a list of regular expressions to match files in the current working directory. The regular expression is matched using ``re.search`` python module. ",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"file",
"exp"
],
"properties": {
"file": {
"$ref": "#/definitions/file"
},
"exp": {
"type": "string",
"description": "Specify a regular expression to run on the selected file name"
},
"item": {
"type": "integer",
"minimum": 0,
"description": "Specify the item number used to index element in `match.group() <https://docs.python.org/3/library/re.html#match-objects>`_"
},
"re": {
"type": "string",
"description": "Specify the regular expression type, it can be either re.search, re.match, or re.fullmatch. By default it uses re.search",
"enum": [
"re.search",
"re.match",
"re.fullmatch"
]
}
}
}
},
"file_regex_in_metrics": {
"type": "object",
"additionalProperties": false,
"description": "Specify a regular expressions on a filepath used for assigning value to metrics. The regular expression is matched using ``re.search`` python module. ",
"required": [
"file",
"exp"
],
"properties": {
"additionalProperties": false,
"file": {
"$ref": "#/definitions/file"
},
"exp": {
"type": "string",
"description": "Specify a regular expression to run on the selected file name"
},
"item": {
"type": "integer",
"minimum": 0,
"description": "Specify the item number used to index element in `match.group() <https://docs.python.org/3/library/re.html#match-objects>`_"
},
"linenum": {
"type": "integer",
"description": "Specify the line number used to extract from the file content where regex is applied"
},
"re": {
"type": "string",
"description": "Specify the regular expression type, it can be either re.search, re.match, or re.fullmatch. By default it uses re.search",
"enum": [
"re.search",
"re.match",
"re.fullmatch"
]
}
}
},
"regex": {
"type": "object",
"additionalProperties": false,
"description": "Perform regular expression search using ``re.search`` python module on stdout/stderr stream for reporting if test ``PASS``. ",
"required": [
"exp",
"stream"
],
"properties": {
"stream": {
"type": "string",
"enum": [
"stdout",
"stderr"
],
"description": "The stream field can be stdout or stderr. buildtest will read the output or error stream after completion of test and check if regex matches in stream"
},
"exp": {
"type": "string",
"description": "Specify a regular expression to run with input stream specified by ``stream`` field. buildtest uses re.search when performing regex"
},
"item": {
"type": "integer",
"minimum": 0,
"description": "Specify the item number used to index element in `match.group() <https://docs.python.org/3/library/re.html#match-objects>`_"
},
"linenum": {
"type": "integer",
"description": "Specify the line number used to extract from the content where regex is applied"
},
"re": {
"type": "string",
"description": "Specify the regular expression type, it can be either re.search, re.match, or re.fullmatch. By default it uses re.search",
"enum": [
"re.search",
"re.match",
"re.fullmatch"
]
}
}
},
"env": {
"type": "object",
"description": "One or more key value pairs for an environment (key=value)",
"minItems": 1,
"items": {
"type": "object",
"minItems": 1,
"propertyNames": {
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
}
}
},
"description": {
"type": "string",
"description": "The ``description`` field is used to document what the test is doing",
"maxLength": 80
},
"summary": {
"type": "string",
"description": "The ``summary`` field is used to document what the test is doing and can be a multi-line string"
},
"tags": {
"description": "Classify tests using a tag name, this can be used for categorizing test and building tests using ``--tags`` option",
"$ref": "#/definitions/string_or_list"
},
"skip": {
"type": "boolean",
"description": "The ``skip`` is a boolean field that can be used to skip tests during builds. By default buildtest will build and run all tests in your buildspec file, if ``skip: True`` is set it will skip the buildspec."
},
"executor": {
"type": "string",
"description": "Select one of the executor name defined in your configuration file (``config.yml``). Every buildspec must have an executor which is responsible for running job. "
},
"needs": {
"description": "A list of test names that are dependency before runnning job",
"type": "array",
"items": [
{
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"patternProperties": {
"^.*$": {
"additionalProperties": false,
"properties": {
"state": {
"$ref": "#/definitions/state"
},
"returncode": {
"$ref": "#/definitions/returncode"
}
}
}
}
}
]
}
]
},
"metrics_field": {
"type": "object",
"additionalProperties": false,
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"description": "Specify python data-type (str, int, float) to convert metric. ",
"enum": [
"str",
"int",
"float"
]
},
"regex": {
"$ref": "#/definitions/regex"
},
"file_regex": {
"$ref": "#/definitions/file_regex_in_metrics"
}
},
"oneOf": [
{
"required": [
"regex"
]
},
{
"required": [
"file_regex"
]
}
]
},
"metrics": {
"type": "object",
"description": "This field is used for defining one or more metrics that is recorded for each test. A metric must have a unique name which is recorded in the test metadata.",
"propertyNames": {
"pattern": "^[A-Za-z0-9_.-]+$"
},
"additionalProperties": {
"$ref": "#/definitions/metrics_field"
}
},
"state": {
"type": "string",
"description": "explicitly mark state of test regardless of status calculation",
"enum": [
"PASS",
"FAIL"
]
},
"returncode": {
"description": "Specify a list of returncodes to match with script's exit code. buildtest will PASS test if script's exit code is found in list of returncodes. You must specify unique numbers as list and a minimum of 1 item in array",
"$ref": "#/definitions/int_or_list"
},
"status": {
"type": "object",
"description": "The status section describes how buildtest detects PASS/FAIL on test. By default returncode 0 is a PASS and anything else is a FAIL, however buildtest can support other types of PASS/FAIL conditions.",
"additionalProperties": false,
"properties": {
"slurm_job_state": {
"type": "string",
"enum": [
"COMPLETED",
"FAILED",
"OUT_OF_MEMORY",
"TIMEOUT"
],
"description": "This field can be used to pass test based on Slurm Job State, if there is a match buildtest will report as ``PASS`` "
},
"pbs_job_state": {
"type": "string",
"description": "This field can be used to pass test based on PBS Job State, if there is a match buildtest will report as ``PASS`` ",
"enum": [
"H",
"S",
"F"
]
},
"lsf_job_state": {
"type": "string",
"description": "This field can be used to pass test based on LSF Job State, if there is a match buildtest will report as ``PASS`` ",
"enum": [
"DONE",
"EXIT"
]
},
"returncode": {
"$ref": "#/definitions/returncode"
},
"regex": {
"$ref": "#/definitions/regex",
"description": "Determine state (PASS/FAIL) of test based on regular expression on output or error stream"
},
"file_regex": {
"$ref": "#/definitions/file_regex",
"description": "Perform a regular expression search on a list of arbitrary files, if expression matches for any file buildtest will report as ``PASS``. This field is useful for checking output of a test that is not captured in stdout or stderr. "
},
"runtime": {
"type": "object",
"description": "The runtime section will pass test based on min and max values and compare with actual runtime. ",
"properties": {
"min": {
"type": "number",
"minimum": 0,
"description": "Specify a minimum runtime in seconds. The test will PASS if actual runtime exceeds min time."
},
"max": {
"type": "number",
"minimum": 0,
"description": "Specify a maximum runtime in seconds. The test will PASS if actual runtime is less than max time"
}
}
},
"assert_ge": {
"description": "Perform assertion of greater and equal (>=) with reference value",
"$ref": "#/definitions/status_check_ge_gt_le_lt"
},
"assert_le": {
"description": "Perform assertion of greater and equal (>=) with reference value",
"$ref": "#/definitions/status_check_ge_gt_le_lt"
},
"assert_gt": {
"description": "Perform assertion of greater than (>) with reference value",
"$ref": "#/definitions/status_check_ge_gt_le_lt"
},
"assert_lt": {
"description": "Perform assertion of less than (<) with reference value",
"$ref": "#/definitions/status_check_ge_gt_le_lt"
},
"assert_eq": {
"description": "Perform assertion of equality (=) with reference value",
"$ref": "#/definitions/status_check_eq_ne"
},
"assert_ne": {
"description": "Perform assertion of not equal (!=) with reference value",
"$ref": "#/definitions/status_check_eq_ne"
},
"assert_range": {
"type": "object",
"description": "Perform assertion based on lower and upper bound",
"additionalProperties": false,
"required": [
"comparisons"
],
"properties": {
"mode": {
"$ref": "#/definitions/mode"
},
"comparisons": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"name",
"lower",
"upper"
],
"properties": {
"name": {
"type": "string",
"description": "Name of metric to use for comparison"
},
"lower": {
"description": "Specify reference value for lower bound",
"type": "number"
},
"upper": {
"description": "Specify reference value for upper bound",
"type": "number"
}
}
}
}
}
},
"contains": {
"description": "Check if metric value is in a list of reference values",
"$ref": "#/definitions/status_check_contains_not_contains"
},
"not_contains": {
"description": "Check if metric value not in a list of reference values ",
"$ref": "#/definitions/status_check_contains_not_contains"
},
"is_symlink": {
"description": "Check for list of files or directory paths that are symbolic links",
"$ref": "#/definitions/list_of_strings"
},
"exists": {
"description": "Check for list of file or directory path for existences using os.path.exists",
"$ref": "#/definitions/list_of_strings"
},
"is_dir": {
"description": "Check for list of filepaths are directories",
"$ref": "#/definitions/list_of_strings"
},
"is_file": {
"description": "Check for list of filepaths are files",
"$ref": "#/definitions/list_of_strings"
},
"file_count": {
"description": "Perform assertion check by comparing file count in a directory",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"dir",
"count"
],
"properties": {
"dir": {
"type": "string",
"description": "Directory path to check for file count"
},
"count": {
"type": "integer",
"description": "Number of files expected in directory",
"minimum": 0
},
"depth": {
"type": "integer",
"description": "Depth of directory to search for files",
"minimum": 0
},
"ext": {
"$ref": "#/definitions/string_or_list",
"description": "File extension to filter files in directory"
},
"filepattern": {
"type": "string",
"description": "Specify a regular expression when searching for files in directory"
},
"filetype": {
"type": "string",
"description": "Specify file type when searching for files in directory. It can be 'file', 'dir' or 'symlink'",
"enum": [
"file",
"dir",
"symlink"
]
},
"file_traverse_limit": {
"type": "integer",
"description": "Limit the number of files to traverse when searching for files in directory",
"minimum": 1,
"default": 10000,
"maximum": 999999
}
}
}
},
"state": {
"$ref": "#/definitions/state",
"description": "explicitly mark state of test regardless of status calculation"
},
"mode": {
"$ref": "#/definitions/mode"
},
"linecount": {
"type": "object",
"description": "Check for number of lines in stdout or stderr stream. If linecount is set, buildtest will check for number of lines in stdout or stderr stream and compare with linecount. If linecount matches buildtest will report as ``PASS``",
"additionalProperties": false,
"required": [
"stream",
"count"
],
"properties": {
"stream": {
"type": "string",
"enum": [
"stdout",
"stderr"
],
"description": "The stream field can be stdout or stderr. buildtest will read the output or error stream after completion of test and check if linecount matches"
},
"count": {
"type": "integer",
"description": "Specify number of lines as reference value to compare with actual output",
"minimum": 0
}
}
},
"file_linecount": {
"type": "array",
"description": "Specify a list of files to perform line count comparison by reading the file and comparing the line count with reference value",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"file",
"count"
],
"properties": {
"file": {
"$ref": "#/definitions/file"
},
"count": {
"type": "integer",
"description": "Specify number of lines as reference value to compare with actual output",
"minimum": 0
}
}
}
}
}
},
"status_check_ge_gt_le_lt": {
"type": "object",
"additionalProperties": false,
"required": [
"comparisons"
],
"properties": {
"mode": {
"$ref": "#/definitions/mode"
},
"comparisons": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"name",
"ref"
],
"properties": {
"name": {
"type": "string",
"description": "Name of metric to use for comparison"
},
"ref": {
"type": "number",
"description": "Specify reference value (int,float) for comparison"
}
}
}
}
}
},
"status_check_eq_ne": {
"type": "object",
"additionalProperties": false,
"required": [
"comparisons"
],
"properties": {
"mode": {
"$ref": "#/definitions/mode"
},
"comparisons": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"name",
"ref"
],
"properties": {
"name": {
"type": "string",
"description": "Name of metric to use for comparison"
},
"ref": {
"description": "Specify reference value (str, int, float) for comparison",
"oneOf": [
{
"type": "number"
},
{
"type": "string"
}
]
}
}
}
}
}
},
"status_check_contains_not_contains": {
"type": "object",
"required": [
"comparisons"
],
"additionalProperties": false,
"properties": {
"mode": {
"$ref": "#/definitions/mode"
},
"comparisons": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"name",
"ref"
],
"properties": {
"name": {
"type": "string",
"description": "Name of metric to use for comparison"
},
"ref": {
"type": "array",
"minItems": 1,
"description": "Specify a list of reference value"
}
}
}
}
}
},
"mode": {
"description": "Determine how the status check is resolved, for instance it can be logical AND or OR",
"type": "string",
"enum": [
"or",
"and",
"OR",
"AND"
]
},
"BB": {
"$ref": "#/definitions/list_of_strings",
"description": "Create burst buffer space, this specifies #BB options in your test."
},
"DW": {
"$ref": "#/definitions/list_of_strings",
"description": "Specify Data Warp option (#DW) when using burst buffer."
},
"sbatch": {
"$ref": "#/definitions/list_of_strings",
"description": "This field is used for specifying #SBATCH options in test script."
},
"bsub": {
"$ref": "#/definitions/list_of_strings",
"description": "This field is used for specifying #BSUB options in test script."
},
"pbs": {
"$ref": "#/definitions/list_of_strings",
"description": "This field is used for specifying #PBS directives in test script."
},
"executors": {
"type": "object",
"description": "Define executor specific configuration",
"patternProperties": {
"description": "Name of executor to override configuration",
"^.*$": {
"additionalProperties": false,
"properties": {
"env": {
"$ref": "#/definitions/env"
},
"vars": {
"$ref": "#/definitions/env"
},
"sbatch": {
"$ref": "#/definitions/list_of_strings"
},
"bsub": {
"$ref": "#/definitions/list_of_strings"
},
"pbs": {
"$ref": "#/definitions/list_of_strings"
},
"BB": {
"$ref": "#/definitions/BB"
},
"DW": {
"$ref": "#/definitions/DW"
},
"status": {
"$ref": "#/definitions/status"
},
"metrics": {
"$ref": "#/definitions/metrics"
}
}
}
}
},
"cc": {
"type": "string",
"description": "Set C compiler wrapper"
},
"fc": {
"type": "string",
"description": "Set Fortran compiler wrapper"
},
"cxx": {
"type": "string",
"description": "Set C++ compiler wrapper"
},
"cflags": {
"type": "string",
"description": "Set C compiler flags."
},
"fflags": {
"type": "string",
"description": "Set Fortran compiler flags."
},
"cxxflags": {
"type": "string",
"description": "Set C++ compiler flags."
},
"ldflags": {
"type": "string",
"description": "Set linker flags"
},
"cppflags": {
"type": "string",
"description": "Set C or C++ preprocessor flags"
},
"run": {
"type": "string",
"description": "Specify a series of commands to run."
},
"module": {
"type": "object",
"additionalProperties": false,
"properties": {
"purge": {
"type": "boolean",
"description": "Run ``module purge`` if purge is set"
},
"load": {
"$ref": "definitions.schema.json#/definitions/list_of_strings",
"description": "Load one or more modules via ``module load``"
},
"restore": {
"description": "Load a collection name via ``module restore``",
"type": "string"
},
"swap": {
"description": "Swap modules using ``module swap``. The swap property expects 2 unique modules.",
"type": "array",
"uniqueItems": true,
"minItems": 2,
"maxItems": 2,
"items": {
"type": "string"
}
}
}
}
}
}