aws-crt 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (322) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/VERSION +1 -1
  4. data/aws-crt-ffi/CMakeLists.txt +49 -41
  5. data/aws-crt-ffi/crt/aws-c-auth/CMakeLists.txt +0 -10
  6. data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/credentials.h +3 -2
  7. data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/private/credentials_utils.h +4 -4
  8. data/aws-crt-ffi/crt/aws-c-auth/source/auth.c +1 -14
  9. data/aws-crt-ffi/crt/aws-c-auth/source/aws_imds_client.c +206 -68
  10. data/aws-crt-ffi/crt/aws-c-auth/source/aws_signing.c +5 -0
  11. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_cached.c +6 -6
  12. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_default_chain.c +16 -1
  13. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_ecs.c +0 -1
  14. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_process.c +0 -1
  15. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_sts_web_identity.c +0 -1
  16. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_x509.c +10 -7
  17. data/aws-crt-ffi/crt/aws-c-auth/source/credentials_utils.c +35 -26
  18. data/aws-crt-ffi/crt/aws-c-auth/source/signable_chunk.c +3 -2
  19. data/aws-crt-ffi/crt/aws-c-auth/tests/CMakeLists.txt +3 -2
  20. data/aws-crt-ffi/crt/aws-c-auth/tests/aws_imds_client_test.c +1 -0
  21. data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_provider_ecs_tests.c +3 -0
  22. data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_provider_process_tests.c +65 -16
  23. data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_tests.c +125 -0
  24. data/aws-crt-ffi/crt/aws-c-auth/tests/sigv4_signing_tests.c +68 -46
  25. data/aws-crt-ffi/crt/aws-c-cal/CMakeLists.txt +8 -3
  26. data/aws-crt-ffi/crt/aws-c-cal/bin/run_x_platform_fuzz_corpus/main.c +9 -0
  27. data/aws-crt-ffi/crt/aws-c-cal/builder.json +11 -3
  28. data/aws-crt-ffi/crt/aws-c-cal/cmake/aws-c-cal-config.cmake +14 -5
  29. data/aws-crt-ffi/crt/aws-c-cal/source/darwin/securityframework_ecc.c +6 -6
  30. data/aws-crt-ffi/crt/aws-c-cal/source/windows/bcrypt_ecc.c +12 -12
  31. data/aws-crt-ffi/crt/aws-c-cal/tests/test_case_helper.h +14 -14
  32. data/aws-crt-ffi/crt/aws-c-common/CMakeLists.txt +21 -1
  33. data/aws-crt-ffi/crt/aws-c-common/README.md +8 -0
  34. data/aws-crt-ffi/crt/aws-c-common/cmake/AwsCFlags.cmake +20 -5
  35. data/aws-crt-ffi/crt/aws-c-common/cmake/AwsFeatureTests.cmake +7 -1
  36. data/aws-crt-ffi/crt/aws-c-common/format-check.sh +1 -1
  37. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/byte_buf.h +14 -0
  38. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/config.h.in +1 -0
  39. data/aws-crt-ffi/crt/{aws-c-auth/include/aws/auth → aws-c-common/include/aws/common}/external/cJSON.h +82 -74
  40. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/json.h +335 -0
  41. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/logging.h +1 -0
  42. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/math.inl +2 -2
  43. data/aws-crt-ffi/crt/aws-c-common/include/aws/common/private/json_impl.h +22 -0
  44. data/aws-crt-ffi/crt/aws-c-common/include/aws/testing/aws_test_harness.h +2 -0
  45. data/aws-crt-ffi/crt/aws-c-common/source/byte_buf.c +36 -0
  46. data/aws-crt-ffi/crt/aws-c-common/source/common.c +5 -2
  47. data/aws-crt-ffi/crt/aws-c-common/source/external/cJSON.c +3113 -0
  48. data/aws-crt-ffi/crt/aws-c-common/source/file.c +9 -0
  49. data/aws-crt-ffi/crt/aws-c-common/source/json.c +348 -0
  50. data/aws-crt-ffi/crt/aws-c-common/source/logging.c +7 -2
  51. data/aws-crt-ffi/crt/aws-c-common/source/posix/system_info.c +8 -0
  52. data/aws-crt-ffi/crt/aws-c-common/source/ref_count.c +3 -1
  53. data/aws-crt-ffi/crt/aws-c-common/source/windows/file.c +47 -0
  54. data/aws-crt-ffi/crt/aws-c-common/source/windows/system_info.c +2 -1
  55. data/aws-crt-ffi/crt/aws-c-common/tests/CMakeLists.txt +5 -0
  56. data/aws-crt-ffi/crt/aws-c-common/tests/byte_buf_test.c +69 -0
  57. data/aws-crt-ffi/crt/aws-c-common/tests/json_test.c +134 -0
  58. data/aws-crt-ffi/crt/aws-c-common/tests/memtrace_test.c +6 -2
  59. data/aws-crt-ffi/crt/aws-c-event-stream/README.md +18 -35
  60. data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream.h +21 -2
  61. data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream_rpc_client.h +14 -2
  62. data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream_rpc_server.h +13 -0
  63. data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/private/event_stream_rpc_priv.h +7 -7
  64. data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream.c +257 -141
  65. data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_channel_handler.c +1 -1
  66. data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_rpc_client.c +31 -8
  67. data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_rpc_server.c +63 -10
  68. data/aws-crt-ffi/crt/aws-c-event-stream/tests/CMakeLists.txt +2 -0
  69. data/aws-crt-ffi/crt/aws-c-event-stream/tests/event_stream_rpc_client_connection_test.c +157 -106
  70. data/aws-crt-ffi/crt/aws-c-event-stream/tests/event_stream_rpc_server_connection_test.c +168 -1
  71. data/aws-crt-ffi/crt/aws-c-event-stream/tests/message_deserializer_test.c +4 -2
  72. data/aws-crt-ffi/crt/aws-c-http/CMakeLists.txt +1 -0
  73. data/aws-crt-ffi/crt/aws-c-http/README.md +8 -0
  74. data/aws-crt-ffi/crt/aws-c-http/bin/elasticurl/main.c +1 -1
  75. data/aws-crt-ffi/crt/aws-c-http/builder.json +4 -3
  76. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/connection.h +8 -1
  77. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/connection_manager.h +45 -1
  78. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/http2_stream_manager.h +63 -12
  79. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/connection_impl.h +2 -1
  80. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_connection.h +20 -2
  81. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_frames.h +1 -0
  82. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_stream.h +42 -13
  83. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/http2_stream_manager_impl.h +17 -0
  84. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/http_impl.h +3 -0
  85. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/random_access_set.h +10 -3
  86. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/request_response_impl.h +3 -17
  87. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/request_response.h +108 -4
  88. data/aws-crt-ffi/crt/aws-c-http/include/aws/http/statistics.h +22 -0
  89. data/aws-crt-ffi/crt/aws-c-http/source/connection.c +8 -3
  90. data/aws-crt-ffi/crt/aws-c-http/source/connection_manager.c +22 -3
  91. data/aws-crt-ffi/crt/aws-c-http/source/connection_monitor.c +32 -14
  92. data/aws-crt-ffi/crt/aws-c-http/source/h1_connection.c +14 -0
  93. data/aws-crt-ffi/crt/aws-c-http/source/h1_encoder.c +7 -4
  94. data/aws-crt-ffi/crt/aws-c-http/source/h2_connection.c +161 -45
  95. data/aws-crt-ffi/crt/aws-c-http/source/h2_decoder.c +37 -8
  96. data/aws-crt-ffi/crt/aws-c-http/source/h2_frames.c +13 -1
  97. data/aws-crt-ffi/crt/aws-c-http/source/h2_stream.c +345 -87
  98. data/aws-crt-ffi/crt/aws-c-http/source/hpack.c +3 -0
  99. data/aws-crt-ffi/crt/aws-c-http/source/http.c +3 -0
  100. data/aws-crt-ffi/crt/aws-c-http/source/http2_stream_manager.c +266 -39
  101. data/aws-crt-ffi/crt/aws-c-http/source/random_access_set.c +9 -3
  102. data/aws-crt-ffi/crt/aws-c-http/source/request_response.c +80 -20
  103. data/aws-crt-ffi/crt/aws-c-http/source/statistics.c +11 -0
  104. data/aws-crt-ffi/crt/aws-c-http/tests/CMakeLists.txt +28 -1
  105. data/aws-crt-ffi/crt/aws-c-http/tests/fuzz/fuzz_h2_decoder_correct.c +5 -3
  106. data/aws-crt-ffi/crt/aws-c-http/tests/h2_test_helper.c +133 -29
  107. data/aws-crt-ffi/crt/aws-c-http/tests/h2_test_helper.h +6 -0
  108. data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/README.md +40 -0
  109. data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/non_tls_server.py +56 -0
  110. data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/server.py +329 -0
  111. data/aws-crt-ffi/crt/aws-c-http/tests/test_connection_manager.c +1 -1
  112. data/aws-crt-ffi/crt/aws-c-http/tests/test_connection_monitor.c +2 -2
  113. data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_client.c +47 -34
  114. data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_encoder.c +4 -4
  115. data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_server.c +15 -12
  116. data/aws-crt-ffi/crt/aws-c-http/tests/test_h2_client.c +582 -25
  117. data/aws-crt-ffi/crt/aws-c-http/tests/test_h2_encoder.c +3 -3
  118. data/aws-crt-ffi/crt/aws-c-http/tests/test_localhost_integ.c +530 -0
  119. data/aws-crt-ffi/crt/aws-c-http/tests/test_stream_manager.c +459 -67
  120. data/aws-crt-ffi/crt/aws-c-io/CMakeLists.txt +4 -0
  121. data/aws-crt-ffi/crt/aws-c-io/builder.json +3 -2
  122. data/aws-crt-ffi/crt/aws-c-io/include/aws/io/channel.h +21 -0
  123. data/aws-crt-ffi/crt/aws-c-io/include/aws/io/io.h +3 -0
  124. data/aws-crt-ffi/crt/aws-c-io/include/aws/io/socket.h +6 -0
  125. data/aws-crt-ffi/crt/aws-c-io/include/aws/io/stream.h +35 -5
  126. data/aws-crt-ffi/crt/aws-c-io/include/aws/io/tls_channel_handler.h +211 -15
  127. data/aws-crt-ffi/crt/aws-c-io/source/channel.c +56 -30
  128. data/aws-crt-ffi/crt/aws-c-io/source/darwin/secure_transport_tls_channel_handler.c +0 -24
  129. data/aws-crt-ffi/crt/aws-c-io/source/io.c +9 -0
  130. data/aws-crt-ffi/crt/aws-c-io/source/{pkcs11.c → pkcs11_lib.c} +162 -22
  131. data/aws-crt-ffi/crt/aws-c-io/source/pkcs11_private.h +18 -20
  132. data/aws-crt-ffi/crt/aws-c-io/source/pkcs11_tls_op_handler.c +221 -0
  133. data/aws-crt-ffi/crt/aws-c-io/source/posix/socket.c +135 -81
  134. data/aws-crt-ffi/crt/aws-c-io/source/retry_strategy.c +12 -8
  135. data/aws-crt-ffi/crt/aws-c-io/source/s2n/s2n_tls_channel_handler.c +252 -215
  136. data/aws-crt-ffi/crt/aws-c-io/source/stream.c +65 -82
  137. data/aws-crt-ffi/crt/aws-c-io/source/tls_channel_handler.c +188 -57
  138. data/aws-crt-ffi/crt/aws-c-io/source/windows/iocp/socket.c +271 -256
  139. data/aws-crt-ffi/crt/aws-c-io/tests/CMakeLists.txt +21 -12
  140. data/aws-crt-ffi/crt/aws-c-io/tests/channel_test.c +32 -4
  141. data/aws-crt-ffi/crt/aws-c-io/tests/io_lib_test.c +37 -0
  142. data/aws-crt-ffi/crt/aws-c-io/tests/pkcs11_test.c +412 -93
  143. data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.crt +15 -0
  144. data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.key +5 -0
  145. data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.p12 +0 -0
  146. data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.p8 +5 -0
  147. data/aws-crt-ffi/crt/aws-c-io/tests/resources/generateCerts.sh +24 -15
  148. data/aws-crt-ffi/crt/aws-c-io/tests/socket_test.c +72 -1
  149. data/aws-crt-ffi/crt/s2n/CMakeLists.txt +6 -1
  150. data/aws-crt-ffi/crt/s2n/bindings/rust/Cargo.toml +1 -0
  151. data/aws-crt-ffi/crt/s2n/bindings/rust/generate/src/main.rs +105 -82
  152. data/aws-crt-ffi/crt/s2n/bindings/rust/generate.sh +1 -0
  153. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls/Cargo.toml +2 -2
  154. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls/src/raw/config.rs +1 -1
  155. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/Cargo.toml +1 -1
  156. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/build.rs +84 -30
  157. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/src/lib.rs +4 -0
  158. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/Cargo.toml +21 -0
  159. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/certs/cert.pem +14 -0
  160. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/certs/key.pem +8 -0
  161. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/client.rs +45 -0
  162. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/server.rs +60 -0
  163. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/src/lib.rs +150 -0
  164. data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/tests/handshake.rs +51 -0
  165. data/aws-crt-ffi/crt/s2n/crypto/s2n_drbg.c +98 -77
  166. data/aws-crt-ffi/crt/s2n/crypto/s2n_drbg.h +10 -7
  167. data/aws-crt-ffi/crt/s2n/crypto/s2n_openssl.h +2 -0
  168. data/aws-crt-ffi/crt/s2n/error/s2n_errno.c +1 -1
  169. data/aws-crt-ffi/crt/s2n/error/s2n_errno.h +1 -0
  170. data/aws-crt-ffi/crt/s2n/s2n.mk +7 -0
  171. data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/repository.py +233 -0
  172. data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/setup-proof.py +8 -7
  173. data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/setup.py +17 -18
  174. data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/util.py +41 -23
  175. data/aws-crt-ffi/crt/s2n/tests/fuzz/LD_PRELOAD/global_overrides.c +3 -3
  176. data/aws-crt-ffi/crt/s2n/tests/integration/s2n_client_endpoint_handshake_test.py +2 -2
  177. data/aws-crt-ffi/crt/s2n/tests/integrationv2/Makefile +13 -42
  178. data/aws-crt-ffi/crt/s2n/tests/integrationv2/README.md +6 -1
  179. data/aws-crt-ffi/crt/s2n/tests/integrationv2/common.py +118 -53
  180. data/aws-crt-ffi/crt/s2n/tests/integrationv2/configuration.py +108 -88
  181. data/aws-crt-ffi/crt/s2n/tests/integrationv2/conftest.py +6 -3
  182. data/aws-crt-ffi/crt/s2n/tests/integrationv2/constants.py +6 -4
  183. data/aws-crt-ffi/crt/s2n/tests/integrationv2/fixtures.py +21 -12
  184. data/aws-crt-ffi/crt/s2n/tests/integrationv2/global_flags.py +1 -0
  185. data/aws-crt-ffi/crt/s2n/tests/integrationv2/processes.py +62 -19
  186. data/aws-crt-ffi/crt/s2n/tests/integrationv2/providers.py +304 -48
  187. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_client_authentication.py +20 -11
  188. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_cross_compatibility.py +41 -17
  189. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_dynamic_record_sizes.py +6 -3
  190. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_early_data.py +105 -48
  191. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_external_psk.py +160 -76
  192. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_fragmentation.py +59 -26
  193. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_happy_path.py +42 -28
  194. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_hello_retry_requests.py +33 -13
  195. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_key_update.py +29 -11
  196. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_ocsp.py +138 -0
  197. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_pq_handshake.py +103 -36
  198. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_session_resumption.py +52 -25
  199. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_signature_algorithms.py +47 -21
  200. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_sni_match.py +13 -9
  201. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_sslyze.py +88 -17
  202. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_version_negotiation.py +71 -22
  203. data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_well_known_endpoints.py +4 -3
  204. data/aws-crt-ffi/crt/s2n/tests/integrationv2/tox.ini +1 -0
  205. data/aws-crt-ffi/crt/s2n/tests/integrationv2/utils.py +50 -15
  206. data/aws-crt-ffi/crt/s2n/tests/litani/CHANGELOG +131 -0
  207. data/aws-crt-ffi/crt/s2n/tests/litani/CONTRIBUTING.md +16 -0
  208. data/aws-crt-ffi/crt/s2n/tests/litani/README.md +36 -14
  209. data/aws-crt-ffi/crt/s2n/tests/litani/THIRD-PARTY +205 -41
  210. data/aws-crt-ffi/crt/s2n/tests/litani/doc/bin/build-html-doc +7 -7
  211. data/aws-crt-ffi/crt/s2n/tests/litani/doc/configure +27 -23
  212. data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-add-job.scdoc +7 -0
  213. data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-dump-run.scdoc +7 -5
  214. data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-transform-jobs.scdoc +248 -0
  215. data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani.scdoc +2 -2
  216. data/aws-crt-ffi/crt/s2n/tests/litani/doc/templates/index.jinja.html +4 -0
  217. data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/README +12 -0
  218. data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/original-run.sh +52 -0
  219. data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/run-all.py +71 -0
  220. data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/README +13 -0
  221. data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-1.sh +34 -0
  222. data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-2.sh +35 -0
  223. data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-3.sh +34 -0
  224. data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-all.py +60 -0
  225. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/README.md +10 -0
  226. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/assumptions.html +42 -0
  227. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/file.dat +7 -0
  228. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/histogram.dat +7 -0
  229. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-1.sh +41 -0
  230. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-2.sh +47 -0
  231. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-3.sh +41 -0
  232. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-all.py +34 -0
  233. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib-table.py +40 -0
  234. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib.plt +5 -0
  235. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib.py +32 -0
  236. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin-output.py +40 -0
  237. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin.plt +5 -0
  238. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin.py +30 -0
  239. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/templates/fib-table.jinja.html +45 -0
  240. data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/templates/sin-output.jinja.html +30 -0
  241. data/aws-crt-ffi/crt/s2n/tests/litani/lib/add_job.py +55 -0
  242. data/aws-crt-ffi/crt/s2n/tests/litani/lib/graph.py +2 -2
  243. data/aws-crt-ffi/crt/s2n/tests/litani/lib/litani.py +6 -1
  244. data/aws-crt-ffi/crt/s2n/tests/litani/lib/litani_report.py +18 -21
  245. data/aws-crt-ffi/crt/s2n/tests/litani/lib/ninja.py +2 -0
  246. data/aws-crt-ffi/crt/s2n/tests/litani/lib/run_printer.py +26 -7
  247. data/aws-crt-ffi/crt/s2n/tests/litani/lib/transform_jobs.py +84 -0
  248. data/aws-crt-ffi/crt/s2n/tests/litani/litani +28 -33
  249. data/aws-crt-ffi/crt/s2n/tests/litani/script/release +220 -0
  250. data/aws-crt-ffi/crt/s2n/tests/litani/templates/dashboard.jinja.html +78 -15
  251. data/aws-crt-ffi/crt/s2n/tests/litani/templates/pipeline.jinja.html +21 -5
  252. data/aws-crt-ffi/crt/s2n/tests/litani/test/README +15 -0
  253. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/run +56 -33
  254. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/custom_stages.py +1 -0
  255. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/cwd.py +1 -0
  256. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/dump_run.py +1 -0
  257. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/graph_line_break.py +1 -0
  258. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/html_node.py +1 -0
  259. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/job_id_env.py +1 -0
  260. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/multiproc_dump_run.py +1 -0
  261. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_pool_serialize.py +1 -0
  262. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_pool_serialize_graph.py +1 -0
  263. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out.py +1 -0
  264. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out_timeout_ignored.py +1 -0
  265. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out_timeout_ok.py +1 -0
  266. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pipeline_order.py +53 -0
  267. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pool_serialize.py +1 -0
  268. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pool_serialize_graph.py +1 -0
  269. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/single_pool.py +1 -0
  270. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out.py +1 -0
  271. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess.py +1 -0
  272. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess_multi_shell.py +1 -0
  273. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess_shell.py +1 -0
  274. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_timeout_ignored.py +1 -0
  275. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_timeout_ok.py +1 -0
  276. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_delete_job.py +54 -0
  277. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_modify_job.py +46 -0
  278. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_no_change_job.py +44 -0
  279. data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/zero_pool.py +1 -0
  280. data/aws-crt-ffi/crt/s2n/tests/litani/test/run +82 -12
  281. data/aws-crt-ffi/crt/s2n/tests/s2n_test.h +58 -33
  282. data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_key_schedule_testlib.c +18 -6
  283. data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_pq_kat_test_utils.c +4 -4
  284. data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_testlib.h +2 -0
  285. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_hello_retry_test.c +66 -2
  286. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_connection_test.c +1 -1
  287. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_drbg_test.c +34 -14
  288. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_fork_generation_number_test.c +28 -5
  289. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_mem_usage_test.c +6 -0
  290. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_override_openssl_random_test.c +1 -1
  291. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_random_test.c +60 -41
  292. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_self_talk_broken_pipe_test.c +2 -2
  293. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_handshake_early_data_test.c +3 -1
  294. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_hybrid_shared_secret_test.c +9 -1
  295. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_key_schedule_rfc8448_test.c +31 -130
  296. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_key_schedule_test.c +2 -4
  297. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_pq_handshake_test.c +11 -6
  298. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_secrets_rfc8448_test.c +19 -21
  299. data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_secrets_test.c +109 -60
  300. data/aws-crt-ffi/crt/s2n/tls/s2n_config.c +1 -0
  301. data/aws-crt-ffi/crt/s2n/tls/s2n_config.h +1 -1
  302. data/aws-crt-ffi/crt/s2n/tls/s2n_connection.c +29 -24
  303. data/aws-crt-ffi/crt/s2n/tls/s2n_connection.h +5 -5
  304. data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_hashes.h +1 -7
  305. data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_io.c +2 -0
  306. data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_transcript.c +0 -44
  307. data/aws-crt-ffi/crt/s2n/tls/s2n_internal.h +0 -1
  308. data/aws-crt-ffi/crt/s2n/tls/s2n_quic_support.h +1 -1
  309. data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_key_schedule.c +1 -2
  310. data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_secrets.c +84 -44
  311. data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_secrets.h +3 -9
  312. data/aws-crt-ffi/crt/s2n/utils/s2n_blob.h +15 -8
  313. data/aws-crt-ffi/crt/s2n/utils/s2n_fork_detection.c +2 -6
  314. data/aws-crt-ffi/crt/s2n/utils/s2n_random.c +9 -9
  315. data/aws-crt-ffi/src/input_stream.c +32 -15
  316. data/ext/compile.rb +13 -5
  317. data/lib/aws-crt/platforms.rb +14 -5
  318. data/lib/aws-crt/string_blob.rb +3 -3
  319. metadata +61 -7
  320. data/aws-crt-ffi/crt/aws-c-auth/source/external/cJSON.c +0 -2987
  321. data/aws-crt-ffi/crt/aws-c-auth/tests/external/cJSON.c +0 -2986
  322. data/aws-crt-ffi/crt/aws-c-io/tests/error_test.c +0 -20
@@ -0,0 +1,248 @@
1
+ litani-transform-jobs(1) "" "Litani Build System"
2
+
3
+ ; Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+
5
+ ; Licensed under the Apache License, Version 2.0 (the "License").
6
+ ; You may not use this file except in compliance with the License.
7
+ ; A copy of the License is located at
8
+
9
+ ; http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ ; or in the "license" file accompanying this file. This file is distributed
12
+ ; on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13
+ ; express or implied. See the License for the specific language governing
14
+ ; permissions and limitations under the License.
15
+
16
+
17
+ # NAME
18
+
19
+ litani transform-jobs - Print a list of jobs to be modified before running
20
+
21
+
22
+ # DESCRIPTION
23
+
24
+ This program allows clients to add to, delete from, or modify a list of Litani
25
+ jobs before running them. The program prints out all the jobs that have been
26
+ added to the current run so far, and then expects to read a new list of jobs on
27
+ stdin. This new list of jobs will be 'saved' and run upon invocation of
28
+ *litani-run-build(1)*.
29
+
30
+ This program prints the list of jobs that have been added so far in JSON format.
31
+ It also expects to read a list of jobs as a JSON list. Each job in the list will
32
+ follow the same schema as the elements of the *["jobs"]["wrapper_arguments"]*
33
+ key in the litani _run.json_ file; see *litani-run.json(5)* for the schema. Most
34
+ users will want to run this program before running *litani run-build*, which
35
+ means that none of the jobs will have started; that means that the JSON schema
36
+ will match that of an unstarted job, meaning the *complete* key will be _false_
37
+ and there will be no *start_time* key.
38
+
39
+ If this program prints a job, and the JSON list written to stdin contains a job
40
+ with the same job id, then Litani will overwrite the original job with the one
41
+ given on stdin. The 'job id' is the value of *["job_id"]* in the job dictionary,
42
+ as specified in *litani-run.json(5)*.
43
+
44
+ If this program prints a job, but a job with the same job id does not exist in
45
+ the list of jobs written to this program's stdin, then that job will be deleted.
46
+
47
+ If this program reads a job on stdin whose job id did not exist in the list of
48
+ jobs printed on stdout, then that job will be added to the list of jobs to be
49
+ executed. However, it is _highly recommended_ to add jobs using
50
+ *litani-add-job(1)* rather than adding a new dict to the JSON list. See
51
+ *CAVEATS* below.
52
+
53
+
54
+ # MOTIVATION & BEST PRACTICES
55
+
56
+ This program allows users to modify Litani-based builds that they do not
57
+ control. Litani-based builds typically use a so-called 'run script' to make the
58
+ following Litani invocations:
59
+
60
+ . *litani init*, once
61
+ . *litani add-job*, for each job to be added
62
+ . *litani run-build*, once
63
+
64
+ If you cannot modify the run script, you will not have a chance to add custom
65
+ jobs before running them. However, if the run script includes a way to allow
66
+ users to invoke *litani transform-jobs* after step 2 but before step 3, then
67
+ users who cannot modify the run script can nevertheless add their own jobs.
68
+
69
+ Here are a couple of suggestions for how to write a run script such that
70
+ downstream users can extend your build with additional jobs.
71
+
72
+ ## Add a --job-transformer flag to specify a custom job-transformer program
73
+
74
+ Suppose that you have a run script called *run.py* that performs the three steps
75
+ above. Consider adding a flag, (we suggest *--job-transformer* _J_) to the
76
+ script. When users pass this flag to *run.py*, it will run _J_ as a subprocess
77
+ after adding all the jobs but just before running *litani run-build*. Users can
78
+ supply their own _J_, which would run *litani transform-jobs* as a subprocess
79
+ and modify jobs as needed.
80
+
81
+
82
+ ## Add a --no-standalone flag to suppress `litani init' and `litani run-build'
83
+
84
+ Suppose that you have various run scripts called *run-1.py*, *run-2.py*, *...*
85
+ that each perform the three steps above, but which each add different jobs to
86
+ the build. Suppose you then add a flag (we suggest *--no-standalone*) to each of
87
+ those scripts, which has the effect of preventing them from running *litani
88
+ init* and *litani run-build*. You can then _combine_ the jobs from all of those
89
+ scripts by running them as follows:
90
+
91
+ ```
92
+ $ litani init # run this manually in your shell
93
+ $
94
+ $ ./run-1.py --no-standalone # add the jobs emitted by run-1.py
95
+ $ # without re-initializing the build
96
+ $ # or running it yet
97
+ $
98
+ $ ./run-2.py --no-standalone # same for run-2.py. You could also
99
+ $ # run these programs in parallel
100
+ $ # because it is safe to run parallel
101
+ $ # invocations of litani add-job
102
+
103
+ ...
104
+
105
+ $ ./transform-all-jobs.sh # This script invokes `litani
106
+ $ # transform-jobs` as a subprocess
107
+ $ # and modifies the jobs
108
+ $
109
+ $ litani run-build # run all jobs added from all scripts
110
+ ```
111
+
112
+ This allows users to 'compose' Litani-based builds that they do not have control
113
+ over, and also modify them before running.
114
+
115
+
116
+ # MULTIPROCESS SAFETY
117
+
118
+ It is safe to run this program in parallel with invocations of
119
+ *litani-add-job(1)*, but this usually doesn't make sense; typically you want to
120
+ ensure that your jobs have been added before transforming them. Therefore, wait
121
+ until all invocations of *litani add-job* have terminated before running this
122
+ program. However, see also *CAVEATS* below for when this does make sense.
123
+
124
+ It is safe to run several invocations of this program at the same time: this
125
+ program always writes jobs out atomically, so an invocation will never read a
126
+ file that has been half-written by another. However, the result of running
127
+ multiple invocations of this program will be unpredictable if the transformation
128
+ is not idempotent, since one invocation may transform a job that has already
129
+ been transformed.
130
+
131
+
132
+ # OPTIONS
133
+
134
+ This program does not accept any command-line options. It does expect to read a
135
+ list of new jobs on stdin, and will block until stdin is closed. To print the
136
+ entire run without modifying any jobs, use *litani-dump-run(1)* instead.
137
+
138
+
139
+ # CAVEATS
140
+
141
+ It is possible to add new jobs using this command, by appending a dict to the
142
+ output of this command and writing the resulting list back to stdin. However,
143
+ this is _not recommended_, because this avoids the error-checking and
144
+ enforcement of internal invariants that *litani-add-job(1)* performs. Thus, it
145
+ is recommended to use *litani-add-job(1)* to add new jobs, either while you
146
+ run *litani transform-jobs*, or after *transform-jobs* terminates.
147
+
148
+
149
+
150
+ # EXAMPLES
151
+
152
+ This section contains code snippets illustrating how this command can be used.
153
+
154
+
155
+ ## Running litani transform-jobs
156
+
157
+ The following Python fragment illustrates how to invoke *litani transform-jobs*
158
+ from a Python script; read the list of jobs; and then write them back to
159
+ *transform-jobs*.
160
+
161
+ ```
162
+ proc = subprocess.Popen(
163
+ [litani, "-v", "transform-jobs"], stdin=subprocess.PIPE,
164
+ stdout=subprocess.PIPE, text=True, bufsize=0)
165
+
166
+ jobs = json.loads(proc.stdout.read())
167
+
168
+ # jobs is now a list of dicts, which can be processed here
169
+
170
+ print(json.dumps(jobs), file=proc.stdin)
171
+ proc.stdin.close()
172
+ proc.wait()
173
+ ```
174
+
175
+
176
+ ## Adding a new root node
177
+
178
+ Sometimes, you want to add a job that runs before all others. That is, you start
179
+ off with a build graph that looks like this:
180
+
181
+ ```
182
+ foo.exe --> foo.out
183
+ \\
184
+ \\
185
+ bar.exe --> bar.out --> final.exe --> final.out
186
+ /
187
+ /
188
+ baz.exe --> baz.out
189
+ ```
190
+
191
+ And you want to print `_echo Starting_` before any job starts to run:
192
+
193
+ ```
194
+ foo.exe --> foo.out
195
+ ________^ \\
196
+ / \\
197
+ echo 'Start' --> fake.out --> bar.exe --> bar.out --> final.exe --> final.out
198
+ \\________ /
199
+ v /
200
+ baz.exe --> baz.out
201
+ ```
202
+
203
+ The way to accomplish this is
204
+
205
+ - Add a new job that emits an output file. The output doesn't have to be a real
206
+ file; you can use *uuidgen(1)* to get a fresh name. You would add this new job
207
+ using *litani-add-job(1)*.
208
+ - Use *litani-transform-jobs(1)* to modify the _foo_, _bar_, and _baz_ jobs so
209
+ that their _"inputs"_ key includes the file that the new job outputs.
210
+
211
+ These steps can be done in either order. Here is a code example:
212
+
213
+ ```
214
+ proc = subprocess.Popen(
215
+ [litani, "transform-jobs"], stdin=subprocess.PIPE,
216
+ stdout=subprocess.PIPE, text=True, bufsize=0)
217
+
218
+ jobs = json.loads(proc.stdout.read())
219
+ # A file name that the new root job will output, and which the old
220
+ # root nodes will depend on as an input. This is not a real file that
221
+ # the new root command will write, so we'll pass it to --phony-outputs
222
+ # rather than --outputs.
223
+ dependency_node = str(uuid.uuid4())
224
+
225
+ for job in jobs:
226
+ if not job["inputs"]:
227
+ job["inputs"] = [dependency_node]
228
+
229
+ print(json.dumps(jobs), file=proc.stdin)
230
+ proc.stdin.close()
231
+ proc.wait()
232
+
233
+ # Now, add the new root job. (It's also fine to do this before or during the
234
+ # transformation, but remember to skip the new job when iterating!)
235
+
236
+ subprocess.run([
237
+ litani, "add-job",
238
+ "--pipeline", "qux",
239
+ "--ci-stage", "build",
240
+ "--command", ">&2 echo Starting && sleep 2",
241
+ "--phony-outputs", dependency_node,
242
+ ], check=True)
243
+ ```
244
+
245
+
246
+ # SEE ALSO
247
+
248
+ - *uuidgen(1)*
@@ -73,8 +73,8 @@ The following is a synopsis of Litani's subcommands:
73
73
  you ran *litani init*.
74
74
 
75
75
  *litani dump-run*
76
- Print a JSON representation of the run so far to stdout while the
77
- build is running.
76
+ Print a JSON representation of the run so far to stdout both while the
77
+ build is running as well as after it has completed.
78
78
 
79
79
  *litani graph*
80
80
  Print the dependency graph of the build in Graphviz format, ready to
@@ -88,6 +88,10 @@
88
88
  code {
89
89
  font-size: 13pt;
90
90
  }
91
+ pre br {
92
+ display: block;
93
+ margin-bottom: -24pt;
94
+ }
91
95
  li {
92
96
  padding-left: 0em;
93
97
  }
@@ -0,0 +1,12 @@
1
+ The original-run.sh script runs four jobs---three in parallel, and then
2
+ a final job that depends on the three outputs.
3
+
4
+ If you cannot modify this script, but want to run a job that runs before
5
+ the first three, you can use *litani-transform-jobs(1)* as show in
6
+ run-all.py.
7
+
8
+ To try this out, run
9
+
10
+ LITANI=../../litani ./run-all.py
11
+
12
+ in this directory.
@@ -0,0 +1,52 @@
1
+ #!/bin/sh
2
+ #
3
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License").
6
+ # You may not use this file except in compliance with the License.
7
+ # A copy of the License is located at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # or in the "license" file accompanying this file. This file is distributed
12
+ # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13
+ # express or implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+
16
+ LITANI=${LITANI:-litani}
17
+
18
+ if [ "$1" != "--no-standalone" ]; then
19
+ "${LITANI}" init --project-name "project-1"
20
+ fi
21
+
22
+
23
+ # 3 parallel jobs, plus a final one that depends on them
24
+
25
+
26
+ "${LITANI}" add-job \
27
+ --command ">&2 echo foo" \
28
+ --pipeline qux \
29
+ --ci-stage build \
30
+ --phony-outputs foo
31
+
32
+ "${LITANI}" add-job \
33
+ --command ">&2 echo bar" \
34
+ --pipeline qux \
35
+ --ci-stage build \
36
+ --phony-outputs bar
37
+
38
+ "${LITANI}" add-job \
39
+ --command ">&2 echo baz" \
40
+ --pipeline qux \
41
+ --ci-stage build \
42
+ --phony-outputs baz
43
+
44
+ "${LITANI}" add-job \
45
+ --command "sleep 1 && >&2 echo Complete" \
46
+ --pipeline qux \
47
+ --ci-stage build \
48
+ --inputs foo bar baz
49
+
50
+ if [ "$1" != "--no-standalone" ]; then
51
+ "${LITANI}" run-build
52
+ fi
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env python3
2
+ #
3
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License").
6
+ # You may not use this file except in compliance with the License.
7
+ # A copy of the License is located at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # or in the "license" file accompanying this file. This file is distributed
12
+ # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13
+ # express or implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+
16
+
17
+ import logging
18
+ import uuid
19
+ import json
20
+ import os
21
+ import pathlib
22
+ import re
23
+ import subprocess
24
+ import sys
25
+
26
+
27
+ litani = os.getenv("LITANI", "litani")
28
+ this_dir = pathlib.Path(__file__).parent
29
+
30
+ subprocess.run(
31
+ [litani, "init", "--project-name", "adding a root job"], check=True)
32
+
33
+ subprocess.run(
34
+ [str(this_dir / "original-run.sh"), "--no-standalone"], check=True)
35
+
36
+
37
+ # ``````````````````````````````````````````````````````````````````````````````
38
+ # IMPORTANT! bufsize must be 0, otherwise the C stdlib will buffer the jobs that
39
+ # we send back to Litani's stdin
40
+ #
41
+ proc = subprocess.Popen(
42
+ [litani, "-v", "transform-jobs"], stdin=subprocess.PIPE,
43
+ stdout=subprocess.PIPE, text=True, bufsize=0)
44
+
45
+ jobs = json.loads(proc.stdout.read())
46
+
47
+ # A file name that the new root job will output, and which the old root nodes
48
+ # will depend on as an input. This is not a real file that the new root command
49
+ # will write, so we'll pass it to --phony-outputs rather than --outputs.
50
+ dependency_node = str(uuid.uuid4())
51
+
52
+ for job in jobs:
53
+ if not job["inputs"]:
54
+ job["inputs"] = [dependency_node]
55
+
56
+ print(json.dumps(jobs), file=proc.stdin)
57
+ proc.stdin.close()
58
+ proc.wait()
59
+
60
+ # Now, add the new root job. (It's also fine to do this before or during the
61
+ # transformation, but remember to skip the new job when iterating!)
62
+
63
+ subprocess.run([
64
+ litani, "add-job",
65
+ "--pipeline", "qux",
66
+ "--ci-stage", "build",
67
+ "--command", ">&2 echo Starting && sleep 2",
68
+ "--phony-outputs", dependency_node,
69
+ ], check=True)
70
+
71
+ subprocess.run([litani, "run-build"], check=True)
@@ -0,0 +1,13 @@
1
+ Each of the run-*.sh scripts in this directory is a standalone Litani-based
2
+ build that runs two jobs: echo "foo" and echo something else.
3
+
4
+ If you wish to run a single build that contains all the jobs except those that
5
+ print foo, you can run run-all.py, which demonstrates how to use the *litani
6
+ transform-jobs* command. This shows how to modify the jobs to be run, without
7
+ needing to manually tweak the run-*.sh scripts.
8
+
9
+ To try this out, run
10
+
11
+ LITANI=../../litani ./run-all.py
12
+
13
+ in this directory.
@@ -0,0 +1,34 @@
1
+ #!/bin/sh
2
+ #
3
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License").
6
+ # You may not use this file except in compliance with the License.
7
+ # A copy of the License is located at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # or in the "license" file accompanying this file. This file is distributed
12
+ # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13
+ # express or implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+
16
+ LITANI=${LITANI:-litani}
17
+
18
+ if [ "$1" != "--no-standalone" ]; then
19
+ "${LITANI}" init --project-name "project-1"
20
+ fi
21
+
22
+ "${LITANI}" add-job \
23
+ --command ">&2 echo foo" \
24
+ --pipeline foo \
25
+ --ci-stage build
26
+
27
+ "${LITANI}" add-job \
28
+ --command ">&2 echo bar" \
29
+ --pipeline foo \
30
+ --ci-stage build
31
+
32
+ if [ "$1" != "--no-standalone" ]; then
33
+ "${LITANI}" run-build
34
+ fi
@@ -0,0 +1,35 @@
1
+ #!/bin/sh
2
+ #
3
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License").
6
+ # You may not use this file except in compliance with the License.
7
+ # A copy of the License is located at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # or in the "license" file accompanying this file. This file is distributed
12
+ # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13
+ # express or implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+
16
+ LITANI=${LITANI:-litani}
17
+
18
+ if [ "$1" != "--no-standalone" ]; then
19
+ "${LITANI}" init --project-name "project-2"
20
+ fi
21
+
22
+
23
+ "${LITANI}" add-job \
24
+ --command ">&2 echo foo" \
25
+ --pipeline foo \
26
+ --ci-stage build
27
+
28
+ "${LITANI}" add-job \
29
+ --command ">&2 echo baz" \
30
+ --pipeline foo \
31
+ --ci-stage build
32
+
33
+ if [ "$1" != "--no-standalone" ]; then
34
+ "${LITANI}" run-build
35
+ fi
@@ -0,0 +1,34 @@
1
+ #!/bin/sh
2
+ #
3
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License").
6
+ # You may not use this file except in compliance with the License.
7
+ # A copy of the License is located at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # or in the "license" file accompanying this file. This file is distributed
12
+ # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13
+ # express or implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+
16
+ LITANI=${LITANI:-litani}
17
+
18
+ if [ "$1" != "--no-standalone" ]; then
19
+ "${LITANI}" init --project-name "project-3"
20
+ fi
21
+
22
+ "${LITANI}" add-job \
23
+ --command ">&2 echo foo" \
24
+ --pipeline foo \
25
+ --ci-stage build
26
+
27
+ "${LITANI}" add-job \
28
+ --command ">&2 echo qux" \
29
+ --pipeline foo \
30
+ --ci-stage build
31
+
32
+ if [ "$1" != "--no-standalone" ]; then
33
+ "${LITANI}" run-build
34
+ fi
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env python3
2
+ #
3
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License").
6
+ # You may not use this file except in compliance with the License.
7
+ # A copy of the License is located at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # or in the "license" file accompanying this file. This file is distributed
12
+ # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13
+ # express or implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+
16
+
17
+ import logging
18
+ import json
19
+ import os
20
+ import pathlib
21
+ import re
22
+ import subprocess
23
+ import sys
24
+
25
+
26
+ litani = os.getenv("LITANI", "litani")
27
+ this_dir = pathlib.Path(__file__).parent
28
+
29
+ subprocess.run(
30
+ [litani, "init", "--project-name", "jobs from multiple projects"],
31
+ check=True)
32
+
33
+ pat = re.compile(r"run-\d.sh")
34
+ for fyle in this_dir.iterdir():
35
+ if pat.match(fyle.name):
36
+ subprocess.run([fyle, "--no-standalone"], check=True)
37
+
38
+
39
+ # ``````````````````````````````````````````````````````````````````````````````
40
+ # IMPORTANT! bufsize must be 0, otherwise the C stdlib will buffer the jobs that
41
+ # we send back to Litani's stdin
42
+ #
43
+ proc = subprocess.Popen(
44
+ [litani, "-v", "transform-jobs"], stdin=subprocess.PIPE,
45
+ stdout=subprocess.PIPE, text=True, bufsize=0)
46
+
47
+ jobs = json.loads(proc.stdout.read())
48
+ jobs = [j for j in jobs if not j["command"].endswith("foo")]
49
+
50
+ print(json.dumps(jobs), file=proc.stdin)
51
+
52
+
53
+ # ``````````````````````````````````````````````````````````````````````````````
54
+ # IMPORTANT! close "litani transform-jobs"'s stdin, otherwise it will block.
55
+ # This process should wait until all jobs have been transformed
56
+ #
57
+ proc.stdin.close()
58
+ proc.wait()
59
+
60
+ subprocess.run([litani, "run-build"], check=True)
@@ -0,0 +1,10 @@
1
+ README
2
+
3
+ The run-all.py script will run examples that demonstrate how jobs in Litani can
4
+ display rich output either on the dashboard or pipeline pages
5
+
6
+ To try this out, run
7
+
8
+ LITANI=../../litani ./run-all.py
9
+
10
+ in this directory.
@@ -0,0 +1,42 @@
1
+ <html>
2
+ <style>
3
+ table {
4
+ font-family: Helvetica, sans-serif;
5
+ border-collapse: collapse;
6
+ width: 100%;
7
+ }
8
+
9
+ td, th {
10
+ border: 1px solid #b0e0e6;
11
+ text-align: left;
12
+ padding: 8px;
13
+ }
14
+
15
+ tr:nth-child(odd) {
16
+ background-color: #b0e0e6;
17
+ }
18
+ </style>
19
+ <body>
20
+ <div id="assumptions">
21
+ <table>
22
+ <tr>
23
+ <th>Assumption to check</th>
24
+ <th>Difficulty</th>
25
+ </tr>
26
+ <tr>
27
+ <td>Bound of input size function</td>
28
+ <td>Easy</td>
29
+ </tr>
30
+ <tr>
31
+ <td>Harness</td>
32
+ <td>Medium</td>
33
+ </tr>
34
+ <tr>
35
+ <td>Function specifications</td>
36
+ <td>Hard</td>
37
+ </tr>
38
+ </table>
39
+ </div>
40
+ </body>
41
+ </html>
42
+
@@ -0,0 +1,7 @@
1
+ pipeline #Assumptions
2
+ "Class\\\_A" 5
3
+ "Class\\\_B" 1
4
+ "Class\\\_C" 2
5
+ "Class\\\_D" 8
6
+ "Class\\\_E" 4
7
+ "Class\\\_F" 0
@@ -0,0 +1,7 @@
1
+ set terminal svg noenhanced size 565,1096
2
+ set style data histogram
3
+ set style fill solid border
4
+ set style histogram clustered
5
+ set xtics rotate out
6
+ set yrange [ 0 : 10 ]
7
+ plot for [COL=2:2] 'file.dat' using COL:xticlabels(1) title columnheader