From 36812a2f003b9114784aa0862cc586cb1c777118 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Wed, 12 Oct 2022 15:07:09 +0100 Subject: CI: Ocaml Smoke diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh index 242ffca693fe..0ac31553c81c 100755 --- a/automation/scripts/qemu-alpine-x86_64.sh +++ b/automation/scripts/qemu-alpine-x86_64.sh @@ -53,6 +53,8 @@ bash /etc/init.d/xencommons start xl list +osmoke || exit 1 + xl -vvv create -c /root/domU.cfg " > etc/local.d/xen.start diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh index 5dc348c71aa9..0da4c5b97187 100755 --- a/automation/scripts/qemu-smoke-dom0-arm32.sh +++ b/automation/scripts/qemu-smoke-dom0-arm32.sh @@ -21,6 +21,8 @@ echo "#!/bin/bash xl list +osmoke || exit 1 + xl -vvv create -c /root/test.cfg " > ./root/xen.start diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh index 1d673f184251..c1fb68172443 100755 --- a/automation/scripts/qemu-smoke-dom0-arm64.sh +++ b/automation/scripts/qemu-smoke-dom0-arm64.sh @@ -50,6 +50,8 @@ bash /etc/init.d/xencommons start xl list +osmoke || exit 1 + xl -vvv create -c /root/domU.cfg " > etc/local.d/xen.start diff --git a/tools/ocaml/Makefile b/tools/ocaml/Makefile index 7252eb23d798..7b79a99df26b 100644 --- a/tools/ocaml/Makefile +++ b/tools/ocaml/Makefile @@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk SUBDIRS := libs SUBDIRS += xenstored +SUBDIRS += smoke .NOTPARALLEL: # targets here must be run in order, otherwise we can try diff --git a/tools/ocaml/smoke/Makefile b/tools/ocaml/smoke/Makefile new file mode 100644 index 000000000000..0ce23c13c3b0 --- /dev/null +++ b/tools/ocaml/smoke/Makefile @@ -0,0 +1,34 @@ +XEN_ROOT = $(CURDIR)/../../.. +OCAML_TOPLEVEL = $(CURDIR)/.. +include $(OCAML_TOPLEVEL)/common.make + +OBJS = osmoke + +OCAMLINCLUDE += \ + -I $(OCAML_TOPLEVEL)/libs/xb \ + -I $(OCAML_TOPLEVEL)/libs/mmap \ + -I $(OCAML_TOPLEVEL)/libs/xc \ + -I $(OCAML_TOPLEVEL)/libs/eventchn + +SMOKELIBS = \ + unix.cmxa \ + -ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/mmap $(OCAML_TOPLEVEL)/libs/mmap/xenmmap.cmxa \ + -ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/eventchn $(OCAML_TOPLEVEL)/libs/eventchn/xeneventchn.cmxa \ + -ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xc $(OCAML_TOPLEVEL)/libs/xc/xenctrl.cmxa \ + -ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xb $(OCAML_TOPLEVEL)/libs/xb/xenbus.cmxa \ + -ccopt -L -ccopt $(XEN_ROOT)/tools/libs/ctrl + +PROGRAMS = osmoke +OCAML_PROGRAM = osmoke + +osmoke_LIBS = $(SMOKELIBS) +osmoke_MLSORTED = $(shell $(OCAMLDEP) -sort $(OBJS:=.ml)) +osmoke_OBJS = $(osmoke_MLSORTED:.ml=) + +all: osmoke + +install: all + $(INSTALL_DIR) $(DESTDIR)$(sbindir) + $(INSTALL_PROG) osmoke $(DESTDIR)$(sbindir) + +include $(OCAML_TOPLEVEL)/Makefile.rules diff --git a/tools/ocaml/smoke/osmoke.ml b/tools/ocaml/smoke/osmoke.ml new file mode 100644 index 000000000000..1910593b0e8c --- /dev/null +++ b/tools/ocaml/smoke/osmoke.ml @@ -0,0 +1,59 @@ +open Printf +(* open Xenctrl + * open Xenmmap *) + +let xch = Xenctrl.interface_open () + +let test_xenversion () = + let ver = Xenctrl.version xch in + printf "Xen version: %d.%d%s\n" ver.major ver.minor ver.extra + +let test_physinfo () = + let p = Xenctrl.physinfo xch in + + printf "Physinfo:\n"; + printf " threads_per_core %d\n" p.threads_per_core; + + let str_of_x86_physinfo_cap_flag f:string = + match f with + (* | CAP_X86_ASSISTED_XAPIC -> "xapic" + * | CAP_X86_ASSISTED_X2APIC -> "x2apic" *) + | _ -> raise Not_found + in + + match p.arch_capabilities with + | X86 x -> + begin + printf " arch cap flags:"; + List.iter (fun x -> printf " %s" (str_of_x86_physinfo_cap_flag x)) x; + printf "\n" + end + | ARM x -> + begin + printf " SVE len: %d\n" x.sve_vl + end + +let test_dominfolist () = + let doms = Xenctrl.domain_getinfolist xch 0 in + + let prettyprint_dom (d:Xenctrl.domaininfo) = + printf "d%d: " d.domid; + match d.arch_config with + | X86 x -> printf "x86\n" + | ARM x -> printf "ARM GIC%d\n" x.gic_version + in + + List.iter prettyprint_dom doms + +let () = + printf "Start...\n%!"; + + test_xenversion (); + test_physinfo (); + test_dominfolist (); + + printf "Starting GC.compact()\n%!"; + Gc.compact (); + printf "Done\n"; + + ()