Skip to content

Commit 3015003

Browse files
authored
Merge pull request xapi-project#33 from lindig/dune
CP-29621 Port from Oasis to Dune
2 parents 291422b + b417e44 commit 3015003

23 files changed

+189
-8610
lines changed

.gitignore

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
*.native
2-
*.swp
3-
41
_build
5-
setup.data
6-
setup.log
2+
.merlin
3+
*.install
4+

.travis.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
language: c
2-
services: docker
2+
sudo: required
3+
service: docker
34
install:
4-
- wget https://raw.githubusercontent.com/xenserver/xenserver-build-env/master/utils/travis-build-repo.sh
5-
script: bash travis-build-repo.sh
6-
sudo: true
5+
- wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-docker.sh
6+
- cp mocks/mock.ml lib/nvml.ml
7+
- cp mocks/mock.c stubs/nvml_stubs.c
8+
script: bash -ex .travis-docker.sh
79
env:
8-
global:
9-
- REPO_PACKAGE_NAME=gpumon
10-
- REPO_CONFIGURE_CMD=true
11-
- REPO_BUILD_CMD=make
12-
- REPO_TEST_CMD='make test'
10+
global:
11+
- PACKAGE=gpumon
12+
- PINS="gpumon:."
13+
- BASE_REMOTE="https://github.com/xapi-project/xs-opam.git"
14+
matrix:
15+
- DISTRO="debian-9-ocaml-4.06"

Makefile

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
DESTDIR ?=
2-
LIBEXECDIR ?= /opt/xensource/libexec
1+
# vim: set noet ts=8:
2+
#
3+
# This Makefile is not called from Opam but only used for
4+
# convenience during development
5+
#
36

4-
TESTS_FLAG=--enable-tests
7+
LIBEXECDIR ?= /opt/xensource/libexec
8+
PLUGINS = $(DESTDIR)$(LIBEXECDIR)/xcp-rrdd-plugins
9+
BUILD = _build/default
10+
DUNE = dune
511

6-
J=4
12+
.PHONY: install all clean test mock
713

8-
LIBEXECDIR?=/opt/xensource/libexec
14+
all:
15+
$(DUNE) build
916

10-
all: build
17+
install: all
18+
install -D -m 755 $(BUILD)/gpumon/gpumon.exe $(PLUGINS)/xcp-rrdd-gpumon
1119

12-
setup.data:
13-
ocaml setup.ml -configure $(TESTS_FLAG)
14-
15-
build: setup.data
16-
ocaml setup.ml -build -j $(J)
20+
clean:
21+
$(DUNE) clean
1722

18-
test: build
19-
ocaml setup.ml -test
23+
test:
24+
$(DUNE) runtest
2025

21-
clean:
22-
ocamlbuild -clean
23-
rm -f setup.data setup.log
26+
mock:
27+
cp mocks/mock.ml lib/nvml.ml
28+
cp mocks/mock.c stubs/nvml_stubs.c
2429

25-
.PHONY: install
26-
install: build
27-
mkdir -p $(DESTDIR)$(LIBEXECDIR)/xcp-rrdd-plugins/
28-
install -m 755 _build/gpumon/gpumon.native $(DESTDIR)$(LIBEXECDIR)/xcp-rrdd-plugins/xcp-rrdd-gpumon

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Build Status](https://travis-ci.org/xenserver/gpumon.svg?branch=master)](https://travis-ci.org/xenserver/gpumon)
2+
13
gpumon
24
------
35

_oasis

Lines changed: 0 additions & 33 deletions
This file was deleted.

_tags

Lines changed: 0 additions & 56 deletions
This file was deleted.

dune-project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(lang dune 1.1)

gpumon.opam

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
opam-version: "2.0"
2+
maintainer: "xen-api@lists.xen.org"
3+
authors: [ "John Else" ]
4+
homepage: "https://github.com/xenserver/gpumon"
5+
bug-reports: "https://github.com/xenserver/gpumon/issues"
6+
build: [
7+
["dune" "build" "-p" name "-j" jobs]
8+
["dune" "runtest" "-p" name "-j" jobs] {with-test}
9+
]
10+
depends: [
11+
"base-threads"
12+
"ounit"
13+
"result"
14+
"rrdd-plugin"
15+
"stdext"
16+
"xcp"
17+
]
18+
dev-repo: "git://github.com/xenserver/gpumon"
19+
synopsis: "The XenServer GPU monitoring daemon"
20+
21+
22+

gpumon/dune

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
(executable
3+
(name gpumon)
4+
(public_name gpumon)
5+
(libraries threads rrdd-plugin xcp.gpumon gpumon_lib))
6+

gpumon/gpumon_server.ml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ module Make(I: Interface):IMPLEMENTATION = struct
3333
module D = Debug.Make(struct let name = Gpumon_interface.service_name end)
3434
open D
3535

36-
type context = unit
37-
3836
module Nvidia = struct
3937

4038
let host_driver_supporting_migration = 390
@@ -45,7 +43,7 @@ module Make(I: Interface):IMPLEMENTATION = struct
4543
| Some interface -> interface
4644
| None -> raise Gpumon_interface.(Gpumon_error NvmlInterfaceNotAvailable)
4745

48-
let get_pgpu_metadata dbg pgpu_address =
46+
let get_pgpu_metadata _dbg pgpu_address =
4947
let this = "get_pgpu_metadata" in
5048
let interface = get_interface_exn () in
5149
try
@@ -72,7 +70,7 @@ module Make(I: Interface):IMPLEMENTATION = struct
7270
| Gpumon_interface.(Gpumon_error (NvmlFailure _)) as err -> raise err
7371
| err -> raise Gpumon_interface.(Gpumon_error (NvmlFailure (Printexc.to_string err)))
7472

75-
let get_vgpu_metadata dbg domid pgpu_address =
73+
let get_vgpu_metadata _dbg domid pgpu_address =
7674
let interface = get_interface_exn () in
7775
let domid' = string_of_int domid in
7876
try
@@ -82,7 +80,7 @@ module Make(I: Interface):IMPLEMENTATION = struct
8280
with err ->
8381
raise Gpumon_interface.(Gpumon_error (NvmlFailure (Printexc.to_string err)))
8482

85-
let get_pgpu_vgpu_compatibility dbg pgpu_metadata vgpu_metadata =
83+
let get_pgpu_vgpu_compatibility _dbg pgpu_metadata vgpu_metadata =
8684
let interface = get_interface_exn () in
8785
let compatibility =
8886
try

0 commit comments

Comments
 (0)