Initial snapshot
This commit is contained in:
commit
fee4dd4e6d
373 changed files with 62144 additions and 0 deletions
61
test/client/Makefile
Normal file
61
test/client/Makefile
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
#
|
||||
# ---------- header -----------------------------------------------------------
|
||||
#
|
||||
# project kaneton
|
||||
#
|
||||
# license kaneton
|
||||
#
|
||||
# file /home/mycure/kaneton/test/client/Makefile
|
||||
#
|
||||
# created julien quintard [fri jun 29 11:19:40 2007]
|
||||
# updated julien quintard [thu feb 10 10:35:45 2011]
|
||||
#
|
||||
|
||||
#
|
||||
# ---------- dependencies -----------------------------------------------------
|
||||
#
|
||||
|
||||
include ../../environment/env.mk
|
||||
|
||||
#
|
||||
# ---------- directives -------------------------------------------------------
|
||||
#
|
||||
|
||||
.PHONY: main build run clear prototypes headers information- \
|
||||
information test- test list- list display- display \
|
||||
submit submit-
|
||||
|
||||
#
|
||||
# ---------- rules ------------------------------------------------------------
|
||||
#
|
||||
|
||||
main:
|
||||
$(call env_launch,$(_TEST_CLIENT_SCRIPT_),,)
|
||||
|
||||
information- information:
|
||||
$(call env_launch,$(_TEST_CLIENT_SCRIPT_),$@,)
|
||||
|
||||
test- test:
|
||||
$(call env_launch,$(_TEST_CLIENT_SCRIPT_),$@,)
|
||||
|
||||
test-%:
|
||||
$(call env_launch,$(_TEST_CLIENT_SCRIPT_),$@,)
|
||||
|
||||
retest- retest:
|
||||
$(call env_launch,$(_TEST_CLIENT_SCRIPT_),$@,)
|
||||
|
||||
retest-%:
|
||||
$(call env_launch,$(_TEST_CLIENT_SCRIPT_),$@,)
|
||||
|
||||
submit- submit:
|
||||
$(call env_launch,$(_TEST_CLIENT_SCRIPT_),$@,)
|
||||
|
||||
submit-%:
|
||||
$(call env_launch,$(_TEST_CLIENT_SCRIPT_),$@,)
|
||||
|
||||
clear:
|
||||
$(call purge,)
|
||||
|
||||
prototypes:
|
||||
|
||||
headers:
|
||||
165
test/client/README
Normal file
165
test/client/README
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
#
|
||||
# ---------- header -----------------------------------------------------------
|
||||
#
|
||||
# project kaneton
|
||||
#
|
||||
# license kaneton
|
||||
#
|
||||
# file /home/mycure/kaneton/test/client/README
|
||||
#
|
||||
# created julien quintard [tue nov 2 05:48:57 2010]
|
||||
# updated julien quintard [thu feb 10 11:17:07 2011]
|
||||
#
|
||||
|
||||
The client script provides the user the possibility to request actions
|
||||
from the test server.
|
||||
|
||||
$> cd ~/kaneton/test/client/
|
||||
$~/kaneton/test/client> make
|
||||
[!] usage: client.py [command]
|
||||
|
||||
[!] commands:
|
||||
[!] retest-[identifier]
|
||||
[!] information
|
||||
[!] test-[environment]::[suite]
|
||||
[!] submit-[stage]
|
||||
$~/kaneton/test/client>
|
||||
|
||||
#
|
||||
# ---------- information ------------------------------------------------------
|
||||
#
|
||||
|
||||
The 'information' command returns information on the user account including
|
||||
the number of tests consumed, the number of tests left etc.
|
||||
|
||||
The example below illustrates this command.
|
||||
|
||||
$~/kaneton/test/client> make information
|
||||
[+] configuration:
|
||||
[+] server: https://test.opaak.org:8421
|
||||
[+] capability: /data/mycure/repositories/kaneton/environment/profile/user/julien.quintard/julien.quintard.cap
|
||||
[+] platform: ibm-pc
|
||||
[+] architecture: ia32/educational
|
||||
|
||||
[+] information:
|
||||
[+] profile:
|
||||
[+] attributes:
|
||||
[+] identifier: julien.quintard
|
||||
[+] type: contributor
|
||||
[+] members:
|
||||
[+] name: Julien Quintard
|
||||
[+] email: julien.quintard@gmail.com
|
||||
[+] suites:
|
||||
[+] k3: This test suite contains tests related to the execution.
|
||||
[+] k2: This test suite focuses on the memory management.
|
||||
[+] k1: This test suite focuses on the event processing.
|
||||
[+] bugs: This suite contains the tests which fail on the official kaneton implementation.
|
||||
[+] kaneton: This test suite triggers all the tests.
|
||||
[+] stages:
|
||||
[+] k3: This stage evaluates the kaneton's execution functionalities.
|
||||
[+] k2: This stage evaluates the kaneton's memory management.
|
||||
[+] k1: This stage evaluates the kaneton's event procesing capabilities.
|
||||
[+] k0: This stage focuses on the assembly language and the boot process through BIOS services.
|
||||
[+] environments:
|
||||
[+] xen: The 'xen' environment is used to thoroughly test a kaneton implementation in a Xen hardware-assisted virtual machine.
|
||||
[+] qemu: The 'qemu' environment is used to test a kaneton implementation through the QEMU processor emulator.
|
||||
[+] database:
|
||||
[+] quotas:
|
||||
[+] xen:
|
||||
[+] k3: -1
|
||||
[+] k2: -1
|
||||
[+] k1: -1
|
||||
[+] bugs: -1
|
||||
[+] kaneton: -1
|
||||
[+] qemu:
|
||||
[+] ibm-pc.ia32/educational:
|
||||
[+] k3: -1
|
||||
[+] k2: -1
|
||||
[+] k1: -1
|
||||
[+] bugs: -1
|
||||
[+] kaneton: -1
|
||||
[+] reports:
|
||||
[+] xen:
|
||||
[+] ibm-pc.ia32/educational:
|
||||
[+] k3:
|
||||
[+] k2:
|
||||
[+] k1:
|
||||
[+] bugs:
|
||||
[+] kaneton:
|
||||
[+] qemu:
|
||||
[+] ibm-pc.ia32/educational:
|
||||
[+] k3:
|
||||
[+] k2:
|
||||
[+] k1:
|
||||
[+] bugs:
|
||||
[+] kaneton:
|
||||
$~/kaneton/test/client>
|
||||
|
||||
#
|
||||
# ---------- test -------------------------------------------------------------
|
||||
#
|
||||
|
||||
The 'test' command issues a request for a test suite to be run in the given
|
||||
environment so that to stress the current kaneton implementation.
|
||||
|
||||
The syntax for this command is test-[environment]::[suite] where [suite]
|
||||
can be any of the 'k1', 'k2', 'k3' etc. stages while [environment] can
|
||||
be 'xen' or 'qemu'. For more information regarding the available suites,
|
||||
stages, environments etc., please refer to the 'information' command.
|
||||
|
||||
$~/kaneton/test/client> make test-xen::k1
|
||||
[+] configuration:
|
||||
[+] server: https://test.opaak.org:8421
|
||||
[+] capability: /data/mycure/repositories/kaneton/environment/profile/user/julien.quintard/julien.quintard.cap
|
||||
[+] platform: ibm-pc
|
||||
[+] architecture: ia32/educational
|
||||
|
||||
[+] generating the kaneton snapshot
|
||||
[+] loading the kaneton snapshot
|
||||
[+] requesting the server
|
||||
[+] the snapshot has been scheduled for testing under the identifier: 20110210:105955
|
||||
$~/kaneton/test/client>
|
||||
|
||||
#
|
||||
# ---------- submit -----------------------------------------------------------
|
||||
#
|
||||
|
||||
Finally, the 'submit' command enables students to definitely submit a
|
||||
kaneton implementation so that their work gets evaluated afterwards according
|
||||
to a specific stage.
|
||||
|
||||
The syntax for this command is submit-[stage].
|
||||
|
||||
$~/kaneton/test/client> make submit-k3
|
||||
[+] configuration:
|
||||
[+] server: https://test.opaak.org:8421
|
||||
[+] capability: /data/mycure/repositories/kaneton/environment/profile/user/julien.quintard/julien.quintard.cap
|
||||
[+] platform: ibm-pc
|
||||
[+] architecture: ia32/educational
|
||||
|
||||
[+] generating the kaneton snapshot
|
||||
[+] loading the kaneton snapshot
|
||||
[+] requesting the server
|
||||
[+] the snapshot has been submitted successfully
|
||||
$~/kaneton/test/client>
|
||||
|
||||
#
|
||||
# ---------- retest -----------------------------------------------------------
|
||||
#
|
||||
|
||||
The 'retest' command provides the administrator the possibility to re-launch
|
||||
the test suite according to the given identifier. This command is useful should
|
||||
an unexpected error occur.
|
||||
|
||||
The syntax for this command is retest-[identifier].
|
||||
|
||||
$~/kaneton/test/client> make retest-20110210:105955
|
||||
[+] configuration:
|
||||
[+] server: https://test.opaak.org:8421
|
||||
[+] capability: /data/mycure/repositories/kaneton/environment/profile/user/julien.quintard/julien.quintard.cap
|
||||
[+] platform: ibm-pc
|
||||
[+] architecture: ia32/educational
|
||||
|
||||
[+] requesting the server
|
||||
[+] the snapshot has been re-tested successfully
|
||||
$~/kaneton/test/client>
|
||||
371
test/client/client.py
Normal file
371
test/client/client.py
Normal file
|
|
@ -0,0 +1,371 @@
|
|||
#
|
||||
# ---------- header -----------------------------------------------------------
|
||||
#
|
||||
# project kaneton
|
||||
#
|
||||
# license kaneton
|
||||
#
|
||||
# file /home/mycure/kaneton/test/client/client.py
|
||||
#
|
||||
# created julien quintard [mon mar 23 00:09:51 2009]
|
||||
# updated julien quintard [mon jun 13 23:39:28 2011]
|
||||
#
|
||||
|
||||
#
|
||||
# ---------- information ------------------------------------------------------
|
||||
#
|
||||
# this script connects to the test server and triggers operations.
|
||||
#
|
||||
# note that this script depends on the ktp package which relies on
|
||||
# the pyopenssl, yaml and other packages.
|
||||
#
|
||||
|
||||
#
|
||||
# ---------- packages ---------------------------------------------------------
|
||||
#
|
||||
|
||||
import sys
|
||||
|
||||
import env
|
||||
import ktp
|
||||
|
||||
#
|
||||
# ---------- globals ----------------------------------------------------------
|
||||
#
|
||||
|
||||
g_server = None
|
||||
g_capability = None
|
||||
g_platform = None
|
||||
g_architecture = None
|
||||
|
||||
#
|
||||
# ---------- functions --------------------------------------------------------
|
||||
#
|
||||
|
||||
#
|
||||
# this function prints the usage.
|
||||
#
|
||||
def Usage():
|
||||
command = None
|
||||
|
||||
env.display(env.HEADER_ERROR, "usage: client.py [command]",
|
||||
env.OPTION_NONE)
|
||||
|
||||
env.display(env.HEADER_NONE, "", env.OPTION_NONE)
|
||||
|
||||
env.display(env.HEADER_ERROR, "commands:", env.OPTION_NONE)
|
||||
|
||||
for command in c_commands:
|
||||
env.display(env.HEADER_ERROR, " " + command, env.OPTION_NONE)
|
||||
|
||||
#
|
||||
# this function simply displays the current configuration.
|
||||
#
|
||||
def Warning():
|
||||
env.display(env.HEADER_NONE, "", env.OPTION_NONE)
|
||||
env.display(env.HEADER_OK, "configuration:", env.OPTION_NONE)
|
||||
env.display(env.HEADER_OK,
|
||||
" server: " + g_server,
|
||||
env.OPTION_NONE)
|
||||
env.display(env.HEADER_OK,
|
||||
" capability: " + g_capability,
|
||||
env.OPTION_NONE)
|
||||
env.display(env.HEADER_OK,
|
||||
" platform: " + str(g_platform),
|
||||
env.OPTION_NONE)
|
||||
env.display(env.HEADER_OK,
|
||||
" architecture: " + str(g_architecture),
|
||||
env.OPTION_NONE)
|
||||
env.display(env.HEADER_NONE, "", env.OPTION_NONE)
|
||||
|
||||
#
|
||||
# this function dumps any Python data structure in a hierarchical way.
|
||||
#
|
||||
def Dump(data, margin = "", alignment = 26):
|
||||
key = None
|
||||
length = None
|
||||
|
||||
if isinstance(data, dict):
|
||||
for key in data:
|
||||
if not isinstance(data[key], dict) and not isinstance(data[key], list):
|
||||
length = len(margin) + len(str(key)) + 1
|
||||
|
||||
env.display(env.HEADER_OK,
|
||||
margin + str(key) + ":" +
|
||||
(alignment - length) * " " +
|
||||
str(data[key]),
|
||||
env.OPTION_NONE)
|
||||
else:
|
||||
env.display(env.HEADER_OK,
|
||||
margin + str(key) + ":",
|
||||
env.OPTION_NONE)
|
||||
|
||||
Dump(data[key], margin + " ", alignment)
|
||||
elif isinstance(data, list):
|
||||
for element in data:
|
||||
Dump(element, margin, alignment)
|
||||
else:
|
||||
env.display(env.HEADER_OK,
|
||||
alignment * " " +
|
||||
str(data),
|
||||
env.OPTION_NONE)
|
||||
|
||||
#
|
||||
# this function asks the server for information related to
|
||||
# the given capability hence user.
|
||||
#
|
||||
# these information are then displayed.
|
||||
#
|
||||
def Information(server, capability, arguments):
|
||||
information = None
|
||||
item = None
|
||||
|
||||
# check the arguments
|
||||
if len(arguments) != 0:
|
||||
Usage()
|
||||
sys.exit(42)
|
||||
|
||||
# warning
|
||||
Warning()
|
||||
|
||||
# retrieve the information.
|
||||
information = ktp.xmlrpc.Call(server.Information(capability))
|
||||
|
||||
# display a message.
|
||||
env.display(env.HEADER_OK,
|
||||
"information:",
|
||||
env.OPTION_NONE)
|
||||
|
||||
# dump the information dictionary.
|
||||
Dump(information, " ")
|
||||
|
||||
#
|
||||
# this function triggers a test.
|
||||
#
|
||||
def Test(server, capability, arguments):
|
||||
snapshot = None
|
||||
suite = None
|
||||
environment = None
|
||||
identifier = None
|
||||
|
||||
# warning
|
||||
Warning()
|
||||
|
||||
# check the arguments
|
||||
if len(arguments) != 2:
|
||||
Usage()
|
||||
sys.exit(42)
|
||||
|
||||
# retrieve the arguments.
|
||||
environment = arguments[0]
|
||||
suite = arguments[1]
|
||||
|
||||
# display a message.
|
||||
env.display(env.HEADER_OK,
|
||||
"generating the kaneton snapshot",
|
||||
env.OPTION_NONE)
|
||||
|
||||
# export the current kaneton implementation.
|
||||
env.launch(env._EXPORT_SCRIPT_,
|
||||
"test:" + capability["type"],
|
||||
env.OPTION_QUIET)
|
||||
|
||||
# display a message.
|
||||
env.display(env.HEADER_OK,
|
||||
"loading the kaneton snapshot",
|
||||
env.OPTION_NONE)
|
||||
|
||||
# read the snapshot.
|
||||
snapshot = env.pull(env._EXPORT_DIR_ + "/output/" + \
|
||||
"test:" + capability["type"] + ".tar.bz2",
|
||||
env.OPTION_NONE)
|
||||
|
||||
# display a message.
|
||||
env.display(env.HEADER_OK,
|
||||
"requesting the server",
|
||||
env.OPTION_NONE)
|
||||
|
||||
# trigger a test.
|
||||
identifier = ktp.xmlrpc.Call(server.Test(capability,
|
||||
ktp.miscellaneous.Binary(snapshot),
|
||||
g_platform,
|
||||
g_architecture,
|
||||
environment,
|
||||
suite))
|
||||
|
||||
# display the received report.
|
||||
env.display(env.HEADER_OK,
|
||||
"the snapshot has been scheduled for testing under the " \
|
||||
"identifier: " + identifier,
|
||||
env.OPTION_NONE)
|
||||
|
||||
#
|
||||
# this function requests the server for re-testing a snapshot.
|
||||
#
|
||||
def Retest(server, capability, arguments):
|
||||
snapshot = None
|
||||
identifier = None
|
||||
|
||||
# warning
|
||||
Warning()
|
||||
|
||||
# check the arguments
|
||||
if len(arguments) != 1:
|
||||
Usage()
|
||||
sys.exit(42)
|
||||
|
||||
# retrieve the arguments.
|
||||
identifier = arguments[0]
|
||||
|
||||
# display a message.
|
||||
env.display(env.HEADER_OK,
|
||||
"requesting the server",
|
||||
env.OPTION_NONE)
|
||||
|
||||
# trigger a test.
|
||||
ktp.xmlrpc.Call(server.Retest(capability,
|
||||
identifier))
|
||||
|
||||
# display a message.
|
||||
env.display(env.HEADER_OK,
|
||||
"the snapshot has been re-tested successfully",
|
||||
env.OPTION_NONE)
|
||||
|
||||
#
|
||||
# this function submits a snapshot.
|
||||
#
|
||||
def Submit(server, capability, arguments):
|
||||
snapshot = None
|
||||
stage = None
|
||||
|
||||
# warning
|
||||
Warning()
|
||||
|
||||
# check the arguments
|
||||
if len(arguments) != 1:
|
||||
Usage()
|
||||
sys.exit(42)
|
||||
|
||||
# retrieve the arguments.
|
||||
stage = arguments[0]
|
||||
|
||||
# check if there is a 'snapshot.tar.bz2' in the client/ directory.
|
||||
if env.path(env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2",
|
||||
env.OPTION_EXIST):
|
||||
# display a message.
|
||||
env.display(env.HEADER_OK,
|
||||
"loading the snapshot '" + \
|
||||
env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2'",
|
||||
env.OPTION_NONE)
|
||||
|
||||
# read the snapshot.
|
||||
snapshot = env.pull(env._TEST_CLIENT_DIR_ + "/snapshot.tar.bz2",
|
||||
env.OPTION_NONE)
|
||||
else:
|
||||
# display a message.
|
||||
env.display(env.HEADER_OK,
|
||||
"generating the kaneton snapshot",
|
||||
env.OPTION_NONE)
|
||||
|
||||
# export the current kaneton implementation.
|
||||
env.launch(env._EXPORT_SCRIPT_,
|
||||
"test:" + capability["type"],
|
||||
env.OPTION_QUIET)
|
||||
|
||||
# display a message.
|
||||
env.display(env.HEADER_OK,
|
||||
"loading the kaneton snapshot",
|
||||
env.OPTION_NONE)
|
||||
|
||||
# read the snapshot.
|
||||
snapshot = env.pull(env._EXPORT_DIR_ + "/output/" + \
|
||||
"test:" + capability["type"] + ".tar.bz2",
|
||||
env.OPTION_NONE)
|
||||
|
||||
# display a message.
|
||||
env.display(env.HEADER_OK,
|
||||
"requesting the server",
|
||||
env.OPTION_NONE)
|
||||
|
||||
# submit the snapshot.
|
||||
ktp.xmlrpc.Call(server.Submit(capability,
|
||||
ktp.miscellaneous.Binary(snapshot),
|
||||
stage))
|
||||
|
||||
# display a message.
|
||||
env.display(env.HEADER_OK,
|
||||
"the snapshot has been submitted successfully",
|
||||
env.OPTION_NONE)
|
||||
|
||||
#
|
||||
# this is the main function.
|
||||
#
|
||||
def Main():
|
||||
global g_server
|
||||
global g_capability
|
||||
global g_platform
|
||||
global g_architecture
|
||||
|
||||
server = None
|
||||
capability = None
|
||||
command = None
|
||||
arguments = None
|
||||
|
||||
# retrieve the command.
|
||||
if len(sys.argv) != 2:
|
||||
Usage()
|
||||
sys.exit(42)
|
||||
|
||||
# set the command.
|
||||
command = sys.argv[1].split("-")[0]
|
||||
|
||||
# set the variables.
|
||||
g_server = env._TEST_SERVER_
|
||||
g_capability = env._TEST_CAPABILITY_
|
||||
g_platform = env._TEST_PLATFORM_
|
||||
g_architecture = env._TEST_ARCHITECTURE_
|
||||
|
||||
# connect to the server.
|
||||
server = ktp.xmlrpc.Connect(g_server)
|
||||
|
||||
# load the student capability.
|
||||
capability = ktp.capability.Load(g_capability)
|
||||
|
||||
# trigger the appropriate command.
|
||||
for name in c_commands:
|
||||
if command == name.split("-")[0]:
|
||||
# set the arguments.
|
||||
if len(sys.argv[1].split("-")) > 1:
|
||||
arguments = sys.argv[1].split("-")[1].split("::")
|
||||
else:
|
||||
arguments = []
|
||||
|
||||
c_commands[name](server, capability, arguments)
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
# wrong command.
|
||||
env.display(env.HEADER_ERROR,
|
||||
"unknown command '" + arguments[0] + "'",
|
||||
env.OPTION_NONE)
|
||||
|
||||
# display usage.
|
||||
Usage()
|
||||
|
||||
#
|
||||
# ---------- constants --------------------------------------------------------
|
||||
#
|
||||
|
||||
c_commands = {
|
||||
"information": Information,
|
||||
"test-[environment]::[suite]": Test,
|
||||
"retest-[identifier]": Retest,
|
||||
"submit-[stage]": Submit
|
||||
}
|
||||
|
||||
#
|
||||
# ---------- entry point ------------------------------------------------------
|
||||
#
|
||||
|
||||
if __name__ == '__main__':
|
||||
Main()
|
||||
Reference in a new issue