def test_handoff(self):
        handoff_file = os.path.abspath(os.path.join(self.temp_dir, "vm-residue.zip"))
        handoff_url = "file://%s" % (handoff_file)

        # 1. VM synthesis using VM overlay to create VM residue
        try:
            synthesis.synthesis(
                self.base_vm_path,
                self.overlay_url,
                disk_only=False,
                zip_container=True,
                handoff_url=handoff_url,
                is_profiling_test=True      # turn off vnc
            )
        except Exception as e:
            self.assertTrue(False, str(e))

        # 2. Check VM residue file
        self.assertTrue(os.path.exists(handoff_file))

        # 3. Resume VM with the VM residue file
        try:
            synthesis.synthesis(
                self.base_vm_path,
                handoff_url,
                disk_only=False,
                zip_container=True,
                handoff_url=None,
                is_profiling_test=True      # turn off vnc
            )
        except Exception as e:
            self.assertTrue(False, str(e))
def run_network(base_path, overlay_path, overlay_mode):
    try:
        synthesis.synthesis(base_path, overlay_path,
                            handoff_url="tcp://rain.elijah.cs.cmu.edu",
                            zip_container=True,
                            overlay_mode=overlay_mode,
                            is_profiling_test=True)
    except Exception, e:
        sys.stderr.write("%s\n" % str(e))
        sys.stderr.write("%s\nFailed to synthesize" % str(traceback.format_exc()))
def run_file(base_path, overlay_path, overlay_mode):
    try:
        synthesis.synthesis(base_path, overlay_path,
                            handoff_url="file://",
                            zip_container=True,
                            overlay_mode=overlay_mode,
                            is_profiling_test=True)
    except Exception, e:
        sys.stderr.write("%s\n" % str(e))
        sys.stderr.write("%s\nFailed to synthesize" % str(traceback.format_exc()))