Esempio n. 1
0
void enkf_tui_analysis_list_modules__(void * arg) {
  enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
  const analysis_config_type * analysis_config = enkf_main_get_analysis_config( enkf_main );

  printf("Available modules: ");
  {
    stringlist_type * modules = analysis_config_alloc_module_names( analysis_config );
    stringlist_fprintf( modules , " " , stdout );
    printf("\n");
    stringlist_free( modules );
  }
}
Esempio n. 2
0
void block_node_exit( int signal ) {
  int job_nr;

  print_status();
  for (job_nr = 0; job_nr < vector_get_size( job_pool ); job_nr++) {
    block_job_type * job = vector_iget( job_pool , job_nr );
    
    if (job->block_job) {
      printf("Job:%ld is running on host: ", lsf_job_get_jobnr( job->lsf_job ));
      stringlist_fprintf( job->hostlist , " " , stdout );
      printf("\n");
    } else
      lsf_driver_kill_job( lsf_driver , job->lsf_job );
    
    block_job_free( job );
  }
  printf("Remember to kill these jobs when the BLOCK is no longer needed\n");
  if (signal != 0)
    exit(0);
}
Esempio n. 3
0
int context_test_destructor(struct context *c)
{
    struct language *l;
    void *context;
    const char *hash_langlinkopts, *hash_linkopts, *hash_objs;

    assert(c->type == CONTEXT_TYPE_TEST);
#ifdef DEBUG
    fprintf(stderr, "context_test_destructor('%s')\n", c->full_path);
#endif

    l = c->language;
    assert(l != NULL);

    context = talloc_new(NULL);

#ifdef DEBUG
    stringlist_fprintf(c->objects, stderr, "obj: %s\n");
#endif

    hash_langlinkopts = stringlist_hashcode(c->language->link_opts, context);
    hash_linkopts = stringlist_hashcode(c->link_opts, context);
    hash_objs = stringlist_hashcode(c->objects, context);
    talloc_unlink(c, (char *)c->link_path);
    c->link_path = talloc_asprintf(c, "%s/%s/%s-%s-%s.bin",
                                   c->obj_dir, c->full_path,
                                   hash_langlinkopts, hash_linkopts,
                                   hash_objs);
    c->link_path_install = talloc_asprintf(c, "%s/%s/%s-%s-%s.ins/%s",
                                           c->obj_dir, c->full_path,
                                           hash_langlinkopts, hash_linkopts,
                                           hash_objs, c->full_path);

    makefile_add_targets(c->mf, c->full_path);
    makefile_add_check(c->mf, c->full_path);

    /* Run the test, producing a tarball with the results. */
    makefile_create_target(c->mf, c->full_path);
    makefile_start_deps(c->mf);
    makefile_add_dep(c->mf, "%s", c->test_parent->full_path);
    makefile_add_dep(c->mf, "%s", c->link_path);
    makefile_addl_dep(c->mf, c->testdeps, "%%s");
    makefile_end_deps(c->mf);
    makefile_start_cmds(c->mf);
    makefile_nam_cmd(c->mf, "echo \"TEST\t%s\"",
                     c->full_path + strlen(c->chk_dir) + 1);
    makefile_add_cmd(c->mf, "mkdir -p `dirname %s`", c->full_path);
    makefile_add_cmd(c->mf, "ptest --test %s --out %s --bin %s",
                     c->link_path, c->full_path, c->test_parent->full_path);
    makefile_end_cmds(c->mf);

    /* Does the actual linking with hashes of the arguments */
    makefile_create_target(c->mf, c->link_path);

    makefile_start_deps(c->mf);
    makefile_addl_dep(c->mf, c->objects, "%%s");
    makefile_addl_dep(c->mf, c->libraries, "%s/lib%%s.%s",
                      c->lib_dir, l->so_ext);
    makefile_end_deps(c->mf);

    makefile_start_cmds(c->mf);
    language_link_pass_vcmd(l, c, false);
    makefile_end_cmds(c->mf);

    makefile_add_distclean(c->mf, c->chk_dir);

    TALLOC_FREE(context);
    return 0;
}
Esempio n. 4
0
int context_library_destructor(struct context *c)
{
    struct language *l;
    char *tmp;
    void *context;
    const char *hash_langlinkopts, *hash_linkopts, *hash_objs;
    char *sname;

    assert(c->type == CONTEXT_TYPE_LIBRARY);

#ifdef DEBUG
    fprintf(stderr, "context_library_destructor('%s')\n", c->full_path);
#endif

    l = c->language;
    assert(l != NULL);

    context = talloc_new(NULL);

    /* Checks if the library name doesn't match and attempts to
     * correct it. */
    if (l->cares_about_static == true) {
        char *new_name;
        char *old_name;
        char *ext;
        char *without_slash;

        old_name = talloc_strdup(context, c->full_path);

        if (strstr(old_name, ".") == NULL)
            abort();

        if (strcmp(strstr(old_name, ".") + 1, c->language->so_ext_canon) == 0)
            c->shared_target = true;
        else if (strcmp(strstr(old_name, ".") + 1, c->language->a_ext_canon)
                 == 0)
            c->shared_target = false;
        else
            abort();

        strstr(old_name, ".")[0] = '\0';

        without_slash = old_name;
        while (strstr(without_slash, "/") != NULL)
            without_slash = strstr(without_slash, "/") + 1;

        ext = c->shared_target ? c->language->so_ext : c->language->a_ext;
        new_name = talloc_asprintf(c, "%s.%s", old_name, ext);

        fprintf(c->mf->file, "LIBDEP__%s := %s.%s\n",
                without_slash,
                old_name, ext);

        c->full_path = new_name;
    }

#ifdef DEBUG
    stringlist_fprintf(c->objects, stderr, "%s\n");
#endif

    hash_langlinkopts = stringlist_hashcode(c->language->link_opts, context);
    hash_linkopts = stringlist_hashcode(c->link_opts, context);
    hash_objs = stringlist_hashcode(c->objects, context);
    talloc_unlink(c, (char *)c->link_path);
    c->link_path = talloc_asprintf(c, "%s/%s/%s-%s-%s-shared.%s",
                                   c->obj_dir, c->full_path,
                                   hash_langlinkopts, hash_linkopts,
                                   hash_objs, c->language->so_ext);

    makefile_add_targets(c->mf, c->full_path);
    makefile_add_all(c->mf, c->full_path);

    /* Creates a "dummy" target that just copies over the actual binary */
    makefile_create_target(c->mf, c->full_path);
    makefile_start_deps(c->mf);
    makefile_add_dep(c->mf, "%s", c->link_path);
    makefile_add_dep(c->mf, "Makefile");
    makefile_end_deps(c->mf);
    makefile_start_cmds(c->mf);
    makefile_nam_cmd(c->mf, "echo \"CP\t%s\"",
                     c->full_path + strlen(c->lib_dir) + 1);
    makefile_add_cmd(c->mf, "mkdir -p `dirname %s`", c->full_path);
    makefile_add_cmd(c->mf, "cp %s %s", c->link_path, c->full_path);
    makefile_end_cmds(c->mf);

    /* Does the actual linking with hashes of the arguments */
    makefile_create_target(c->mf, c->link_path);

    makefile_start_deps(c->mf);

    makefile_addl_dep(c->mf, c->objects, "%%s");

    /* If the language isn't compiled then we won't detect any changes
     * when we try and build it -- it'll just get copied.  In this
     * case we're just going to force a dependency on the Makefile, as
     * that'll ensure it gets built. */
    if (!language_needs_compile(l, c)) {
        makefile_add_dep(c->mf, "Makefile");
        language_deps_vadd_dep(l, c, c->mf);
    }

    makefile_end_deps(c->mf);

    makefile_start_cmds(c->mf);
    language_slib_pass_vcmd(l, c);
    makefile_end_cmds(c->mf);

    /* There is an install/uninstall target */
    tmp = talloc_asprintf(context, "echo -e \"INS\\t%s\"", c->full_path);
    makefile_add_install(c->mf, tmp);
    tmp = talloc_asprintf(context,
                          "mkdir -p `dirname $D\"%s/%s\"` >& /dev/null || true",
                          c->prefix, c->full_path);
    makefile_add_install(c->mf, tmp);
    tmp =
        talloc_asprintf(context,
                        "install -m a=r %s $D/`dirname \"%s/%s\"`",
                        c->full_path, c->prefix, c->full_path);
    makefile_add_install(c->mf, tmp);

    tmp = talloc_asprintf(context, "%s/%s", c->prefix, c->full_path);
    makefile_add_uninstall(c->mf, tmp);

    makefile_add_distclean(c->mf, c->lib_dir);

    /* Add this library to the big global list of libraries.  The idea
     * here is that we can handle recursive library dependencies this
     * way. */
    sname = talloc_strndup(context, c->called_path + 3,
                           strstr(c->called_path + 3, ".")
                           - (c->called_path + 3));

    if (lib_deps == NULL) {
        lib_deps_ctx = talloc_init("context_library_destructor(): lib_deps");
        atexit(&context_destructor);
        lib_deps = liblist_new(lib_deps_ctx);
    }

    liblist_add(lib_deps, sname);

    stringlist_add_to_liblist(c->libraries, lib_deps, sname);

    TALLOC_FREE(context);
    return 0;
}
Esempio n. 5
0
int context_binary_destructor(struct context *c)
{
    struct language *l;
    char *tmp;
    void *context;
    const char *hash_langlinkopts, *hash_linkopts, *hash_objs;

    assert(c->type == CONTEXT_TYPE_BINARY);
#ifdef DEBUG
    fprintf(stderr, "context_binary_destructor('%s')\n", c->full_path);
#endif

    l = c->language;
    assert(l != NULL);

    context = talloc_new(NULL);

#ifdef DEBUG
    stringlist_fprintf(c->objects, stderr, "obj: %s\n");
#endif

    hash_langlinkopts = stringlist_hashcode(c->language->link_opts, context);
    hash_linkopts = stringlist_hashcode(c->link_opts, context);
    hash_objs = stringlist_hashcode(c->objects, context);
    talloc_unlink(c, (char *)c->link_path);
    c->link_path = talloc_asprintf(c, "%s/%s/%s-%s-%s.bin",
                                   c->obj_dir, c->full_path,
                                   hash_langlinkopts, hash_linkopts,
                                   hash_objs);
    c->link_path_install = talloc_asprintf(c, "%s/%s/%s-%s-%s.ins/%s",
                                           c->obj_dir, c->full_path,
                                           hash_langlinkopts, hash_linkopts,
                                           hash_objs, c->full_path);

    makefile_add_targets(c->mf, c->full_path);
    makefile_add_all(c->mf, c->full_path);
    makefile_add_all_install(c->mf, c->link_path_install);

    /* Creates a "dummy" target that just copies over the actual binary */
    makefile_create_target(c->mf, c->full_path);
    makefile_start_deps(c->mf);
    makefile_add_dep(c->mf, "%s", c->link_path);
    makefile_add_dep(c->mf, "Makefile");
    makefile_end_deps(c->mf);
    makefile_start_cmds(c->mf);
    makefile_nam_cmd(c->mf, "echo \"CP\t%s\"",
                     c->full_path + strlen(c->bin_dir) + 1);
    makefile_add_cmd(c->mf, "mkdir -p `dirname %s`", c->full_path);
    makefile_add_cmd(c->mf, "cp %s %s", c->link_path, c->full_path);
    makefile_end_cmds(c->mf);

    /* Does the actual linking with hashes of the arguments */
    makefile_create_target(c->mf, c->link_path);

    makefile_start_deps(c->mf);

    makefile_addl_dep(c->mf, c->objects, "%%s");
    makefile_addl_dep(c->mf, c->libraries, "$(LIBDEP__%s%%s)",
                      c->lib_dir);

    makefile_end_deps(c->mf);

    makefile_start_cmds(c->mf);
    language_link_pass_vcmd(l, c, false);
    makefile_end_cmds(c->mf);

    /* Link a second time, but with the install path now */
    makefile_create_target(c->mf, c->link_path_install);

    makefile_start_deps(c->mf);

    makefile_addl_dep(c->mf, c->objects, "%%s");
    makefile_addl_dep(c->mf, c->libraries, "$(wildcard %s/lib%%s.%s)",
                      c->lib_dir, l->so_ext);
    makefile_addl_dep(c->mf, c->libraries, "$(wildcard %s/lib%%s.%s)",
                      c->lib_dir, l->a_ext);

    makefile_end_deps(c->mf);

    makefile_start_cmds(c->mf);
    language_link_pass_vcmd(l, c, true);
    makefile_end_cmds(c->mf);

    /* There is an install/uninstall target */
    tmp = talloc_asprintf(context, "echo -e \"INS\\t%s\"", c->full_path);
    makefile_add_install(c->mf, tmp);
    tmp = talloc_asprintf(context,
                          "mkdir -p `dirname $D/\"%s/%s\"` >& /dev/null || true",
                          c->prefix, c->full_path);
    makefile_add_install(c->mf, tmp);
    tmp =
        talloc_asprintf(context,
                        "install -m a=rx %s $D/`dirname \"%s/%s\"`",
                        c->link_path_install, c->prefix, c->full_path);
    makefile_add_install(c->mf, tmp);

    tmp = talloc_asprintf(context, "%s/%s", c->prefix, c->full_path);
    makefile_add_uninstall(c->mf, tmp);

    makefile_add_distclean(c->mf, c->bin_dir);

    TALLOC_FREE(context);
    return 0;
}
void test_empty() {
  stringlist_type * s = stringlist_alloc_new();
  stringlist_fprintf( s , "\n" , stdout );
}
Esempio n. 7
0
void ert_test_context_fwrite_workflow_job( FILE * stream , const char * job_name , const stringlist_type * args) {
  fprintf(stream , "%s  " , job_name);
  stringlist_fprintf(args , " ", stream);
  fprintf(stream , "\n");
}