ADD_TESH(tesh-self-catch-signal --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/catch-signal.tesh)
ENDIF()
+IF(enable_java)
+ IF(WIN32)
+ SET(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/teshsuite/java/\;${SIMGRID_FULL_JAR}")
+ STRING(REPLACE "\;" "§" TESH_CLASSPATH "${TESH_CLASSPATH}")
+ ELSE()
+ SET(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/teshsuite/java/:${SIMGRID_FULL_JAR}")
+ ENDIF()
+ ADD_TESH(tesh-java-sleep-host-off --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/teshsuite/java ${CMAKE_HOME_DIRECTORY}/teshsuite/java/sleep_host_off/sleep_host_off.tesh)
+ENDIF()
### GENERIC ###
# BEGIN TESH TESTS
set(TESHSUITE_CMAKEFILES_TXT
teshsuite/bug-17132/CMakeLists.txt
+ teshsuite/java/CMakeLists.txt
+ teshsuite/java/sleep_host_off/CMakeLists.txt
teshsuite/mc/CMakeLists.txt
teshsuite/mc/dwarf/CMakeLists.txt
teshsuite/mc/dwarf_expression/CMakeLists.txt
add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/xbt)
+add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/java)
+add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/java/sleep_host_off)
+
add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/mc)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/mc/dwarf)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/mc/dwarf_expression)
--- /dev/null
+cmake_minimum_required(VERSION 2.6)
+
+set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
+
+set(xml_files
+ ${xml_files}
+ PARENT_SCOPE
+ )
+set(txt_files
+ ${txt_files}
+ PARENT_SCOPE
+ )
--- /dev/null
+cmake_minimum_required(VERSION 2.6)
+
+set(example java_sleep_host_off)
+set(sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/Main.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/SleepHostOff.java
+ )
+
+if(enable_java)
+ add_custom_command(
+ COMMENT "Building ${example}..."
+ OUTPUT ${example}_compiled
+ DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
+ COMMAND ${JAVA_COMPILE} -classpath ${SIMGRID_JAR}
+ -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
+ COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
+ COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
+ )
+ add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+endif()
+
+set(tesh_files
+ ${tesh_files}
+ ${CMAKE_CURRENT_SOURCE_DIR}/sleep_host_off.tesh
+ PARENT_SCOPE
+ )
+set(xml_files
+ ${xml_files}
+ ${CMAKE_CURRENT_SOURCE_DIR}/sleep_host_off_d.xml
+ PARENT_SCOPE
+ )
+set(examples_src
+ ${examples_src}
+ ${sources}
+ PARENT_SCOPE
+ )
+set(bin_files
+ ${bin_files}
+ PARENT_SCOPE
+ )
+set(txt_files
+ ${txt_files}
+ ${CMAKE_CURRENT_SOURCE_DIR}/README
+ PARENT_SCOPE
+ )
--- /dev/null
+package sleep_host_off;
+
+import org.simgrid.msg.Host;
+import org.simgrid.msg.HostNotFoundException;
+import org.simgrid.msg.Msg;
+import org.simgrid.msg.NativeException;
+
+public class Main {
+
+ public static void main(String[] args) throws NativeException {
+ /* Init. internal values */
+ Msg.init(args);
+
+ if (args.length < 2) {
+ Msg.info("Usage : Main platform_file.xml dployment_file.xml");
+ System.exit(1);
+ }
+
+ /* construct the platform and deploy the application */
+ Msg.createEnvironment(args[0]);
+ Msg.deployApplication(args[1]);
+
+ try {
+ Msg.run();
+ } catch (Exception e){
+ System.out.println("Bye bye the program crashes !");
+ }
+
+ }
+}
--- /dev/null
+/* Copyright (c) 2014. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+package sleep_host_off;
+
+import org.simgrid.msg.*;
+import org.simgrid.msg.Process;
+import org.simgrid.trace.Trace;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+public class SleepHostOff extends Process{
+ public static Host jupiter = null;
+
+ public SleepHostOff(Host host, String name, String[]args) {
+ super(host,name,args);
+ }
+
+ public void main(String[] strings) throws MsgException {
+
+ try {
+ jupiter = Host.getByName("Jupiter");
+ } catch (HostNotFoundException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+
+ Msg.info("**** **** **** ***** ***** Test Sleep ***** ***** **** **** ****");
+ Msg.info("Test sleep: Create a process on Jupiter, the process simply make periodic sleep, turn off Jupiter");
+ new Process(jupiter, "sleep", null) {
+ public void main(String[] args) {
+ while (true) {
+ Msg.info("I'm not dead");
+ try {
+ Process.sleep(10);
+ } catch (HostFailureException e) {
+ Msg.info("catch HostException");
+ e.printStackTrace();
+ }
+ }
+ }
+ }.start();
+
+ Process.sleep(20);
+ Msg.info("Stop Jupiter");
+ jupiter.off();
+ Msg.info("Jupiter has been stopped");
+ Process.sleep(300);
+ Msg.info("Test sleep seems ok, cool !(number of Process : " + Process.getCount() + ", it should be 1 (i.e. the Test one))\n");
+ }
+}
--- /dev/null
+$ java -classpath ${classpath:=.} sleep_host_off.Main ${srcdir:=.}/../../examples/platforms/small_platform.xml ${srcdir:=.}/sleep_host_off/sleep_host_off_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+>
--- /dev/null
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
+ <!-- The master process (with some arguments) -->
+ <process host="Tremblay" function="sleep_host_off.SleepHostOff">
+ </process>
+</platform>
test =6;
if (xbt_dynar_member(tests, &test)){
+ /*XBT_INFO("Test 5: Turn on Jupiter, assign a VM on Jupiter, launch a process inside the VM, and turn off the node");
+ // Create VM0
+ int dpRate = 70;
+ msg_vm_t vm0;
+MSG_vm_create (msg_host_t ind_pm, const char *name, int ncpus, int ramsize, int net_cap, char *disk_path, int disksize, int mig_netspeed, int dp_intensity)
+ vm0 = MSG_vm_create_core(jupiter, "vm0");
+ params.ramsize = 1L * 1000 * 1000 * 1000; // 1Gbytes
+ MSG_host_set_params(vm0, ¶ms);
+ MSG_vm_start(vm0);
+ XVM vm0 = null;
+ vm0 = new XVM(
+ host1,
+ "vm0",
+ 1, // Nb of vcpu
+ 2048, // Ramsize,
+ 125, // Net Bandwidth
+ null, //VM disk image
+ -1, //size of disk image,
+ 125, // Net bandwidth,
+ dpRate // Memory intensity
+ );
+ vm0.start();
+ vm0.setLoad(90);
+
+ host1.off();
+ Msg.info("Test 5 is also weird: when the node host1 is turned off once again, the VM and its daemon are not killed." +
+ " However, the issue regarding the shutdown of hosted VMs can be seen a feature not a bug ;)\n");*/
}
test = 7;
return 0;
}
-// adsein: Is this really a daemon ? it ran only one task ? I just added a stupid loop
+// adsein: Is this really a daemon ? it ran only one task ? I just added a stupid loop
int process_daemon(int argc, char *argv[])
{
msg_task_t task = NULL;