EngineOptions get_randomized_paths() {
  EngineOptions options;
  options.memory_.rigorous_memory_boundary_check_ = true;
  std::string uniquefier = get_random_name();
  std::cout << "test uniquefier=" << uniquefier << std::endl;
  {
    std::stringstream str;
    str << "tmp_folders/" << uniquefier << "/logs/node_$NODE$/logger_$LOGGER$";
    options.log_.folder_path_pattern_.assign(str.str());
  }

  {
    std::stringstream str;
    str << "tmp_folders/" << uniquefier << "/snapshots/node_$NODE$";
    options.snapshot_.folder_path_pattern_.assign(str.str());
  }

  options.savepoint_.savepoint_path_.assign(
    std::string("tmp_folders/") + uniquefier + "/savepoints.xml");

  // Mainly for performance reasons, we now put debug logs to
  //  /dev/shm/foedus_test/glog/<unique_name>.
  // For some reason, /tmp of our cloud machines are not tmpfs!! It's usual filesystem.
  // Of course it's super slow. Wtf!
  options.debugging_.debug_log_dir_.assign(
    std::string("/dev/shm/foedus_test/glog/") + uniquefier);

  return options;
}
Beispiel #2
0
void Lobotomizer::apply(Patient& patient)
{
  patient.modify_mental_health(LOB_MENTAL_HEALTH_MODIFIER);
  patient.modify_physical_health(LOB_PHYSICAL_HEALTH_MODIFIER);
  if(rand()%100 < LOB_KILL_BRAIN_CHANCE)
    patient.modify_mental_health(-patient.get_mental_health());
  if(rand()%100 < LOB_RENAME_CHANCE)
    patient.add_to_name(get_random_name());

  m_num_uses++;

  return;
}
Beispiel #3
0
void create()
{
	int force;
	seteuid(getuid());

	get_random_name();

        set("long", 
        "这是一个忠心耿耿的随从。\n");
        set("gender", "男性");
        set("age", 34);
        set("attitude", "heroism");
        set("shen_type", 0);
        set("str", 20);
        set("int", 20);
        set("con", 20);
        set("dex", 20);
	force = 150;
	set("max_neili", force*10);
	set("neili", force*10);
	set("max_jingli", force*8);
	set("jingli", force*8);
	set("max_qi", force*8);
	set("max_jing", force*6);
	set("eff_jing", force*6);
	set("eff_jing", force*6);
	set("jing", force*6);
	set("eff_qi", force*8);
	set("qi", force*8);
        
        set("jiali", 50);
        set("combat_exp", 100000);

	set("chat_chance_combat", 50);

        setup();
        carry_object("/d/beijing/obj/junfu")->wear();
}
std::string get_random_tmp_file_path(const std::string& name) {
  std::string uniquefier = get_random_name();
  std::stringstream str;
  str << "tmp_folders/" << uniquefier << "/" << name;
  return str.str();
}
Beispiel #5
0
/* Check open/openat (as specified by OP and WRAPPER) with a specific
   PATH/FLAGS/MODE combination.  */
static void
check_wrapper_flags_mode (const char *op, wrapper_func wrapper,
                          const char *path, int flags, mode_t mode)
{
  int fd = wrapper (path, flags | O_TMPFILE, mode);
  struct stat64 st;
  if (fstat64 (fd, &st) != 0)
    {
      printf ("error: fstat64: %m\n");
      exit (1);
    }

  /* Verify that the mode was correctly processed.  */
  int actual_mode = st.st_mode & 0777;
  if (actual_mode != mode)
    {
      printf ("error: unexpected mode; expected 0%03o, actual 0%03o\n",
              mode, actual_mode);
      exit (1);
    }

  /* Check that the file is marked as deleted in /proc.  */
  if (!is_file_deteted (fd))
    {
      printf ("error: path in /proc is not marked as deleted\n");
      exit (1);
    }

  /* Check that the file can be turned into a regular file with
     linkat.  Open a file descriptor for the directory at PATH.  Use
     AT_FDCWD if PATH is ".", to exercise that functionality as
     well.  */
  int path_fd;
  if (strcmp (path, ".") == 0)
    path_fd = AT_FDCWD;
  else
    {
      path_fd = open (path, O_RDONLY | O_DIRECTORY);
      if (path_fd < 0)
        {
          printf ("error: open (\"%s\"): %m\n", path);
          exit (1);
        }
    }

  /* Use a hard-to-guess name for the new directory entry.  */
  char *new_name = get_random_name ();

  /* linkat does not require privileges if the path in /proc/self/fd
     is used.  */
  char *proc_fd_path = xasprintf ("/proc/self/fd/%d", fd);
  if (linkat (AT_FDCWD, proc_fd_path, path_fd, new_name,
              AT_SYMLINK_FOLLOW) == 0)
    {
      if (unlinkat (path_fd, new_name, 0) != 0 && errno != ENOENT)
        {
          printf ("error: unlinkat (\"%s/%s\"): %m\n", path, new_name);
          exit (1);
        }
    }
  else
    {
      /* linkat failed.  This is expected if O_EXCL was specified.  */
      if ((flags & O_EXCL) == 0)
        {
          printf ("error: linkat failed after %s (\"%s\", 0x%x, 0%03o): %m\n",
                  op, path, flags, mode);
          exit (1);
        }
    }

  free (proc_fd_path);
  free (new_name);
  if (path_fd != AT_FDCWD)
    close (path_fd);
  close (fd);
}
	BOOST_FOREACH(el::String &name, textures)
	{
		name = get_random_name();
	}