-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from yfyf/refactor-update-for-tests
Split Update module into components and add tests
- Loading branch information
Showing
30 changed files
with
1,774 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
cd "$(dirname "$0")/.." | ||
|
||
dune test "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
(library | ||
(name curl) | ||
(modules curl) | ||
(libraries cohttp-lwt-unix uri base) | ||
(libraries cohttp-lwt-unix uri base config) | ||
(preprocess (pps lwt_ppx))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(** Global system configuration set by the build system *) | ||
module System = struct | ||
(** Version, set by build system *) | ||
let version = | ||
"@PLAYOS_VERSION@" | ||
|
||
(** URL from where to get updates, set by build system *) | ||
let update_url = | ||
"@PLAYOS_UPDATE_URL@" | ||
|
||
(** URL to which kiosk is pointed *) | ||
let kiosk_url = | ||
"@PLAYOS_KIOSK_URL@" | ||
|
||
(** PlayOS bundle name prefix *) | ||
let bundle_name = | ||
"@PLAYOS_BUNDLE_NAME@" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(library | ||
(name config) | ||
(modules config) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module type S = sig | ||
(** [get_status unit] returns current RAUC status *) | ||
val get_status : unit -> Rauc.status Lwt.t | ||
|
||
(** [get_booted_slot unit] returns the currently booted slot *) | ||
val get_booted_slot : unit -> Rauc.Slot.t Lwt.t | ||
|
||
(** [mark_good slot] marks the slot [slot] as good *) | ||
val mark_good : Rauc.Slot.t -> unit Lwt.t | ||
|
||
(** [get_primary unit] returns current primary slot, if any *) | ||
val get_primary : unit -> Rauc.Slot.t option Lwt.t | ||
|
||
(** [install source] install the bundle at path [source] *) | ||
val install : string -> unit Lwt.t | ||
end | ||
|
||
module RaucOBus(OBusRef: sig val peer: Rauc.t end): S = struct | ||
let t = OBusRef.peer | ||
|
||
let get_status () : Rauc.status Lwt.t = | ||
let () = Printf.printf "%s" "Getting status" in | ||
Rauc.get_status t | ||
|
||
let get_booted_slot () : Rauc.Slot.t Lwt.t = | ||
Rauc.get_booted_slot t | ||
|
||
let mark_good = Rauc.mark_good t | ||
|
||
let get_primary () : Rauc.Slot.t option Lwt.t = | ||
Rauc.get_primary t | ||
|
||
let install : string -> unit Lwt.t = | ||
Rauc.install t | ||
end | ||
|
||
let build_module rauc_peer : (module S) = | ||
(module RaucOBus (struct let peer = rauc_peer end)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module type S = sig | ||
(** [get_status unit] returns current RAUC status *) | ||
val get_status : unit -> Rauc.status Lwt.t | ||
|
||
(** [get_booted_slot unit] returns the currently booted slot *) | ||
val get_booted_slot : unit -> Rauc.Slot.t Lwt.t | ||
|
||
(** [mark_good slot] marks the slot [slot] as good *) | ||
val mark_good : Rauc.Slot.t -> unit Lwt.t | ||
|
||
(** [get_primary unit] returns current primary slot, if any *) | ||
val get_primary : unit -> Rauc.Slot.t option Lwt.t | ||
|
||
(** [install source] install the bundle at path [source] *) | ||
val install : string -> unit Lwt.t | ||
end | ||
|
||
val build_module : Rauc.t -> (module S) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.