Skip to content

Commit

Permalink
Merge branch 'master' into fix-naked-pointer-cipher
Browse files Browse the repository at this point in the history
  • Loading branch information
Firgeis authored Jul 23, 2023
2 parents bdfbd71 + 10b62a2 commit d438fb6
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 29 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ jobs:
run: opam install .
- name: Build and test
if: ${{ matrix.setup.runtest }}
run: opam install -t .
run: |
opam install -t .
eval $(opam env)
dune build @github_action_tests
nix-build:
runs-on: ${{ matrix.setup.os }}
Expand Down
4 changes: 2 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Unreleased
===
0.7.0 (2023-07-12)
=====

- Bump OpenSSL minimum requirement to 1.1.0 and stop using deprecated functions
(#121).
Expand Down
4 changes: 3 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
(lang dune 2.7)

(name ssl)
(version 0.7.0)

(generate_opam_files true)

(source
(github melange-re/melange))
(github savonet/ocaml-ssl))

(maintainers "Antonio Monteiro <[email protected]>")

Expand All @@ -23,6 +24,7 @@
(depends
(ocaml
(>= "4.03.0"))
(ocaml (and :with_test (>= "4.08.0")))
dune-configurator
conf-libssl
(alcotest :with-test)
Expand Down
20 changes: 10 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ buildDunePackage {
checkInputs = [ alcotest ];

inherit doCheck;
checkPhase = ''
dune build -p ssl @runtest @github_action_tests ''${enableParallelBuilding:+-j $NIX_BUILD_CORES}
'';
}
5 changes: 3 additions & 2 deletions ssl.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.7.0"
synopsis: "Bindings for OpenSSL"
maintainer: ["Antonio Monteiro <[email protected]>"]
authors: ["Samuel Mimram <[email protected]>"]
Expand All @@ -9,6 +10,7 @@ bug-reports: "https://github.com/savonet/ocaml-ssl/issues"
depends: [
"dune" {>= "2.7"}
"ocaml" {>= "4.03.0"}
"ocaml" {with_test & >= "4.08.0"}
"dune-configurator"
"conf-libssl"
"alcotest" {with-test}
Expand All @@ -29,5 +31,4 @@ build: [
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/melange-re/melange.git"
depexts: [ "openssl" { with-test } ]
dev-repo: "git+https://github.com/savonet/ocaml-ssl.git"
1 change: 0 additions & 1 deletion ssl.opam.template

This file was deleted.

15 changes: 15 additions & 0 deletions tests/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
(alias
(name github_action_tests)
(deps
(alias_rec runtest)))

(library
(name util)
(modules util)
Expand All @@ -14,6 +19,16 @@
(modules ssl_comm)
(libraries ssl alcotest))

(executable
(name ssl_version)
(modules ssl_version)
(libraries ssl alcotest))

(rule
(alias github_action_tests)
(action
(run ./ssl_version.exe)))

(test
(name ssl_context)
(modules ssl_context)
Expand Down
12 changes: 0 additions & 12 deletions tests/ssl_comm.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,11 @@ let test_error_queue () =
check string "Library string" "SSL routines" (Option.get err.lib);
check string "Reason string" "system lib" (Option.get err.reason)

let test_version () =
let ch = Unix.open_process_in "openssl version" in
let m, n, p =
Scanf.(bscanf (Scanning.from_channel ch)) "OpenSSL %d.%d.%d" (fun x y z ->
x, y, z)
in
Unix.close_process_in ch |> ignore;
check int "major" m Ssl.native_library_version.major;
check int "minor" n Ssl.native_library_version.minor;
check int "patch" p Ssl.native_library_version.patch

let () =
Alcotest.run
"Ssl communication"
[ ( "Communication"
, [ test_case "Test init" `Quick test_init
; test_case "Test version" `Quick test_version
; test_case "Test error queue" `Quick test_error_queue
] )
]
27 changes: 27 additions & 0 deletions tests/ssl_version.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
open Alcotest
open Ssl

let test_init () = init () |> ignore

(* This test is not super robust b/c `openssl` might not be installed or
installed but linked to a different shared libary. For this reason, this test
is only run in our internal github action CI. *)
let test_version () =
let ch = Unix.open_process_in "openssl version" in
let m, n, p =
Scanf.(bscanf (Scanning.from_channel ch)) "OpenSSL %d.%d.%d" (fun x y z ->
x, y, z)
in
Unix.close_process_in ch |> ignore;
check int "major" m Ssl.native_library_version.major;
check int "minor" n Ssl.native_library_version.minor;
check int "patch" p Ssl.native_library_version.patch

let () =
Alcotest.run
"Ssl version"
[ ( "Version"
, [ test_case "Test init" `Quick test_init
; test_case "Test version" `Quick test_version
] )
]

0 comments on commit d438fb6

Please sign in to comment.