void tests_start_mpfr (void) { test_version (); /* don't buffer, so output is not lost if a test causes a segv etc */ setbuf (stdout, NULL); #if defined HAVE_LOCALE_H && defined HAVE_SETLOCALE /* Added on 2005-07-09. This allows to test MPFR under various locales. New bugs will probably be found, in particular with LC_ALL="tr_TR.ISO8859-9" because of the i/I character... */ setlocale (LC_ALL, ""); #endif #ifdef MPFR_FPU_PREC set_fpu_prec (); #endif #ifdef MPFR_TEST_DIVBYZERO /* Define to test the use of MPFR_ERRDIVZERO */ feclearexcept (FE_ALL_EXCEPT); #endif tests_memory_start (); tests_rand_start (); tests_limit_start (); default_emin = mpfr_get_emin (); default_emax = mpfr_get_emax (); }
int main (void) { char buffer[256]; /* Test the MPFR version. */ test_version (); sprintf (buffer, "%d.%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL); if (strcmp (buffer, gmp_version) == 0) return 0; if (__GNU_MP_VERSION_PATCHLEVEL == 0) { sprintf (buffer, "%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR); if (strcmp (buffer, gmp_version) == 0) return 0; } /* In some cases, it may be acceptable to have different versions for the header and the library, in particular when shared libraries are used (e.g., after a bug-fix upgrade of the library). Versioning takes care of that, as long as the user has a correct configuration (which is not always the case, hence the following warning). Moreover MPFR uses GMP internals, which may lead to incompatibilities even though GMP's public interface has not changed (the following warning is useful in that case too). */ printf ("WARNING! The versions of gmp.h (%s) and libgmp (%s) do not " "match.\nThis may lead to errors, in particular with MPFR. " "If some tests fail,\nplease check that first. As we are not " "sure, we do not regard this as\nan error.\n", buffer, gmp_version); return 0; }
int main() { test_version(); test_debug(); return 0; }
int main (void) { char buffer[256]; #ifdef __MPIR_VERSION printf ("[tversion] MPIR: header %d.%d.%d, library %s\n", __MPIR_VERSION, __MPIR_VERSION_MINOR, __MPIR_VERSION_PATCHLEVEL, mpir_version); #else printf ("[tversion] GMP: header %d.%d.%d, library %s\n", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL, gmp_version); #endif printf ("[tversion] MPFR tuning parameters from %s\n", MPFR_TUNE_CASE); /* Test the MPFR version. */ test_version (); sprintf (buffer, "%d.%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL); if (strcmp (buffer, gmp_version) == 0) return 0; if (__GNU_MP_VERSION_PATCHLEVEL == 0) { sprintf (buffer, "%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR); if (strcmp (buffer, gmp_version) == 0) return 0; } /* In some cases, it may be acceptable to have different versions for the header and the library, in particular when shared libraries are used (e.g., after a bug-fix upgrade of the library, and versioning ensures that this can be done only when the binary interface is compatible). However, when recompiling software like here, this should never happen (except if GMP has been upgraded between two "make check" runs, but there's no reason for that). A difference between the versions of gmp.h and libgmp probably indicates either a bad configuration or some other inconsistency in the development environment, and it is better to fail (in particular for automatic installations). */ printf ("ERROR! The versions of gmp.h (%s) and libgmp (%s) do not " "match.\nThe possible causes are:\n", buffer, gmp_version); printf (" * A bad configuration in your include/library search paths.\n" " * An inconsistency in the include/library search paths of\n" " your development environment; an example:\n" " http://gcc.gnu.org/ml/gcc-help/2010-11/msg00359.html\n" " * GMP has been upgraded after the first \"make check\".\n" " In such a case, try again after a \"make clean\".\n" " * A new or non-standard version naming is used in GMP.\n" " In this case, a patch may already be available on the\n" " MPFR web site. Otherwise please report the problem.\n"); printf ("In the first two cases, this may lead to errors, in particular" " with MPFR.\nIf some other tests fail, please solve that" " problem first.\n"); return 1; }
bool VCWaitReady(Command_t * command, int msecond) { int ret_val, time_wait; reset_time_out(); time_wait = 0; while( time_wait <= msecond) { ret_val = test_version(command); if(ret_val == 0) { return(1); } time_wait = get_time_wait(); } return (0); }
int main (void) { char buffer[256]; const char *version; test_version (); version = mpfr_get_version (); /* This test is disabled when a suffix (e.g. -dev) has been defined. */ #if 1 sprintf (buffer, "%d.%d.%d", MPFR_VERSION_MAJOR, MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL); if (strcmp (buffer, version) != 0) { /* All the other problems should have been detected by test_version. */ printf ("Incorrect MPFR version! (%s header vs %s library)\n" "This error should have never occurred and may be due " "to a corrupted 'mpfr.h'.\n", buffer, version); exit (1); } #endif if (__GNU_MP_VERSION_PATCHLEVEL != 0) sprintf (buffer, "%d.%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL); else sprintf (buffer, "%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR); /* In some cases, it may be acceptable to have different versions for the header and the library, in particular when shared libraries are used (e.g., after a bug-fix upgrade of the library). Versioning takes care of that, as long as the user has a correct configuration (which is not always the case, hence the following warning). Moreover MPFR uses GMP internals, which may lead to incompatibilities even though GMP's public interface has not changed (the following warning is useful in that case too). */ if (strcmp (buffer, gmp_version) != 0) printf ("The versions of gmp.h (%s) and libgmp (%s) do not seem to " "match.\nThis may lead to errors, in particular with MPFR. " "If some tests fail,\nplease check that first. As we are not " "sure, we do not regard this as\nan error.\n", buffer, gmp_version); return 0; }
int main (int argc, char *argv[]) { test_init_gettext (); test_init (); test_suggest_help (); test_version (); test_daemonise (); test_set_pidfile (); test_read_pidfile (); test_write_pidfile (); test_main_loop (); test_main_loop_add_func (); return 0; }
void execute_line(char *cmdbuf) { int argc; char *argv[MAXARGS]; argc = parse(cmdbuf, argv); if (argc == 0) return; if (!strcmp(argv[0], "noop")) test_noop(); else if (!strcmp(argv[0], "connect") || !strcmp(argv[0], "c")) test_connect(argc, argv); else if (!strcmp(argv[0], "disconnect") || !strcmp(argv[0], "d")) test_disconnect(); else if (!strcmp(argv[0], "host")) test_host(); else if (!strcmp(argv[0], "motd") || !strcmp(argv[0], "m")) test_motd(); else if (!strcmp(argv[0], "query") || !strcmp(argv[0], "qy")) test_query(argc, argv); else if (!strcmp(argv[0], "auth") || !strcmp(argv[0], "a")) test_krb5_auth(); else if (!strcmp(argv[0], "proxy") || !strcmp(argv[0], "p")) test_proxy(argc, argv); else if (!strcmp(argv[0], "access")) test_access(argc, argv); else if (!strcmp(argv[0], "dcm")) test_dcm(); else if (!strcmp(argv[0], "script") || !strcmp(argv[0], "s")) test_script(argc, argv); else if (!strcmp(argv[0], "list_requests") || !strcmp(argv[0], "lr") || !strcmp(argv[0], "?")) test_list_requests(); else if (!strcmp(argv[0], "quit") || !strcmp(argv[0], "Q")) quit = 1; else if (!strcmp(argv[0], "version") || !strcmp(argv[0], "v")) test_version(argc, argv); else if (!strcmp(argv[0], "krb4_auth") || !strcmp(argv[0], "4")) test_auth(); else { fprintf(stderr, "moira: Unknown request \"%s\". " "Type \"?\" for a request list.\n", argv[0]); } }
enum piglit_result piglit_display(void) { enum piglit_result res; res = test_version(); if (res != PIGLIT_PASS) return res; res = test_extension_list(); if (res != PIGLIT_PASS) return res; res = test_clearing(); if (res != PIGLIT_PASS) return res; return res; }
int VCGetVersion(Command_t * command) { int ret_val; command->data[0] = IV_I2C_CMD_GET_VERSION; ret_val = send_cmd(command, APP_ID_CAPT | capt_nr, (IV_I2C_CMD_CTRL | 0x0100), 2); if(ret_val < 0) { ret_val = test_version(command); if(ret_val == 0) { if(command->data[0] == 2 && command->data[1] == 30 && command->data[2] == 0 && command->data[3] == 0) { return(2); } } return 0; } return command->data[0]; }
int search_package_hashtable(const unsigned int name, const unsigned int version, const unsigned int operator) { unsigned int probe_address = 0; unsigned int probe_decrement = 0; make_hash(name_hashtable[name], &probe_address, &probe_decrement, PACKAGE_HASH_PRIME); while(package_hashtable[probe_address] != NULL) { if (package_hashtable[probe_address]->name == name) { if (operator == VER_ANY) { return(probe_address); } if (test_version(package_hashtable[probe_address]->version, version, operator)) { return(probe_address); } } probe_address -= probe_decrement; if ((int)probe_address < 0) { probe_address += PACKAGE_HASH_PRIME; } } return(probe_address); }
int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count) { int *conflicts = NULL; int conflicts_num = 0; int state_status; int state_flag; int state_want; unsigned int status_package_num; int i = deb_start; int j, k; /* Check for conflicts * TODO: TEST if conflicts with other packages to be installed * * Add install packages and the packages they provide * to the list of files to check conflicts for */ /* Create array of package numbers to check against * installed package for conflicts*/ while (deb_file[i] != NULL) { const unsigned int package_num = deb_file[i]->package; conflicts = xrealloc(conflicts, sizeof(int) * (conflicts_num + 1)); conflicts[conflicts_num] = package_num; conflicts_num++; /* add provides to conflicts list */ for (j = 0; j < package_hashtable[package_num]->num_of_edges; j++) { if (package_hashtable[package_num]->edge[j]->type == EDGE_PROVIDES) { const int conflicts_package_num = search_package_hashtable( package_hashtable[package_num]->edge[j]->name, package_hashtable[package_num]->edge[j]->version, package_hashtable[package_num]->edge[j]->operator); if (package_hashtable[conflicts_package_num] == NULL) { /* create a new package */ common_node_t *new_node = (common_node_t *) xmalloc(sizeof(common_node_t)); new_node->name = package_hashtable[package_num]->edge[j]->name; new_node->version = package_hashtable[package_num]->edge[j]->version; new_node->num_of_edges = 0; new_node->edge = NULL; package_hashtable[conflicts_package_num] = new_node; } conflicts = xrealloc(conflicts, sizeof(int) * (conflicts_num + 1)); conflicts[conflicts_num] = conflicts_package_num; conflicts_num++; } } i++; } /* Check conflicts */ for (i = 0; i < conflicts_num; i++) { /* Check for conflicts */ for (j = 0; j < STATUS_HASH_PRIME; j++) { if (status_hashtable[j] == NULL) { continue; } state_flag = get_status(j, 2); state_status = get_status(j, 3); if ((state_status != search_name_hashtable("installed")) && (state_flag != search_name_hashtable("want-install"))) { continue; } status_package_num = status_hashtable[j]->package; for (k = 0; k < package_hashtable[status_package_num]->num_of_edges; k++) { const edge_t *package_edge = package_hashtable[status_package_num]->edge[k]; if (package_edge->type != EDGE_CONFLICTS) { continue; } if (package_edge->name != package_hashtable[conflicts[i]]->name) { continue; } /* There is a conflict against the package name * check if version conflict as well */ if (test_version(package_hashtable[deb_file[i]->package]->version, package_edge->version, package_edge->operator)) { error_msg_and_die("Package %s conflict with %s", name_hashtable[package_hashtable[deb_file[i]->package]->name], name_hashtable[package_hashtable[status_package_num]->name]); } } } } /* Check dependendcies */ i = 0; while (deb_file[i] != NULL) { const common_node_t *package_node = package_hashtable[deb_file[i]->package]; int status_num = 0; for (j = 0; j < package_hashtable[deb_file[i]->package]->num_of_edges; j++) { const edge_t *package_edge = package_node->edge[j]; const unsigned int package_num = search_package_hashtable(package_edge->name, package_edge->version, package_edge->operator); status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]); state_status = get_status(status_num, 3); state_want = get_status(status_num, 1); switch (package_edge->type) { case(EDGE_PRE_DEPENDS): case(EDGE_OR_PRE_DEPENDS): /* It must be already installed */ /* NOTE: This is untested, nothing apropriate in my status file */ if ((package_hashtable[package_num] == NULL) || (state_status != search_name_hashtable("installed"))) { error_msg_and_die("Package %s pre-depends on %s, but it is not installed", name_hashtable[package_node->name], name_hashtable[package_edge->name]); } break; case(EDGE_DEPENDS): case(EDGE_OR_DEPENDS): /* It must be already installed, or to be installed */ if ((package_hashtable[package_num] == NULL) || ((state_status != search_name_hashtable("installed")) && (state_want != search_name_hashtable("want_install")))) { error_msg_and_die("Package %s depends on %s, but it is not installed, or flaged to be installed", name_hashtable[package_node->name], name_hashtable[package_edge->name]); } break; } } i++; } free(conflicts); return(TRUE); }
static bool go(bool result_only, size_t object_size, size_t binary_size, const char* name) { // setup if (!result_only) { printf("%s: ================\n", name); printf("%s: setting up size %i\n", name, (int)object_size); } if (!setup_test(object_size)) { fprintf(stderr, "%s: failed to get setup result.\n", name); return false; } // if this isn't a benchmark (the file creators), nothing left to do if (!is_benchmark()) { teardown_test(); if (!result_only) printf("%s: done\n", name); return true; } // figure out a reasonable number of iterations between checking the time int iterations; #ifdef __arm__ iterations = 1; #else iterations = 32; #endif for (size_t i = 5; i > object_size; --i) iterations <<= 3; uint32_t hash_result; // warm up if (!result_only) printf("%s: warming for %.0f seconds \n", name, WARM_TIME); double start_time = dtime(); while (true) { for (int i = 0; i < iterations; ++i) { hash_result = 0; if (!run_wrapper(&hash_result)) { fprintf(stderr, "%s: failed to get benchmark result.\n", name); return false; } } if (dtime() - start_time > WARM_TIME) break; } // run tests if (!result_only) printf("%s: running for %.0f seconds\n", name, WORK_TIME); int total_iterations = 0; start_time = dtime(); double end_time; while (true) { for (int i = 0; i < iterations; ++i) { hash_result = HASH_INITIAL_VALUE; if (!run_wrapper(&hash_result)) { fprintf(stderr, "%s: failed to get benchmark result.\n", name); return false; } ++total_iterations; } end_time = dtime(); if (end_time - start_time > WORK_TIME) break; } // print results double per_time = (end_time - start_time) / (double)total_iterations * (1000.0 * 1000.0); if (result_only) { printf("%f\n", per_time); } else { printf("%s: %i iterations took %f seconds\n", name, total_iterations, end_time - start_time); printf("%s: %f microseconds per iteration\n", name, per_time); printf("%s: hash result of last run: %08x\n", name, hash_result); } // write score if (!result_only) { FILE* file = fopen("results.csv", "a"); fprintf(file, "\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",%i,%f,%i,%i,\"%08x\"\n", name, test_language(), test_version(), test_filename(), test_format(), (int)object_size, per_time, (int)binary_size, #if BENCHMARK_SIZE_OPTIMIZED 1, #else 0, #endif hash_result); fclose(file); } teardown_test(); return true; }
int main (void) { int err = 0; /* Test the GMP and MPFR versions. */ if (test_version ()) exit (1); printf ("[tversion] MPFR %s\n", MPFR_VERSION_STRING); /* TODO: We may want to output info for non-GNUC-compat compilers too. See: * http://sourceforge.net/p/predef/wiki/Compilers/ * http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros * * For ICC, do not check the __ICC macro as it is obsolete and not always * defined. */ #define COMP "[tversion] Compiler: " #ifdef __INTEL_COMPILER # ifdef __VERSION__ # define ICCV " [" __VERSION__ "]" # else # define ICCV "" # endif printf (COMP "ICC %d.%d.%d" ICCV "\n", __INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE); #elif (defined(__GNUC__) || defined(__clang__)) && defined(__VERSION__) # ifdef __clang__ # define COMP2 COMP # else # define COMP2 COMP "GCC " # endif printf (COMP2 "%s\n", __VERSION__); #endif /************** More information about the C implementation **************/ /* The following macros are currently used by src/mpfr-cvers.h and/or src/mpfr-impl.h; they may have an influcence on how MPFR is compiled. */ #if defined(__STDC__) || defined(__STDC_VERSION__) printf ("[tversion] C standard: __STDC__ = " #if defined(__STDC__) MAKE_STR(__STDC__) #else "undef" #endif ", __STDC_VERSION__ = " #if defined(__STDC_VERSION__) MAKE_STR(__STDC_VERSION__) #else "undef" #endif "\n"); #endif #if defined(__GNUC__) printf ("[tversion] __GNUC__ = " MAKE_STR(__GNUC__) ", __GNUC_MINOR__ = " #if defined(__GNUC_MINOR__) MAKE_STR(__GNUC_MINOR__) #else "undef" #endif "\n"); #endif #if defined(__ICC) || defined(__INTEL_COMPILER) printf ("[tversion] Intel compiler: __ICC = " #if defined(__ICC) MAKE_STR(__ICC) #else "undef" #endif ", __INTEL_COMPILER = " #if defined(__INTEL_COMPILER) MAKE_STR(__INTEL_COMPILER) #else "undef" #endif "\n"); #endif #if defined(_WIN32) || defined(_MSC_VER) printf ("[tversion] MS Windows: _WIN32 = " #if defined(_WIN32) MAKE_STR(_WIN32) #else "undef" #endif ", _MSC_VER = " #if defined(_MSC_VER) MAKE_STR(_MSC_VER) #else "undef" #endif "\n"); #endif #if defined(__GLIBC__) printf ("[tversion] __GLIBC__ = " MAKE_STR(__GLIBC__) ", __GLIBC_MINOR__ = " #if defined(__GLIBC_MINOR__) MAKE_STR(__GLIBC_MINOR__) #else "undef" #endif "\n"); #endif /*************************************************************************/ #ifdef __MPIR_VERSION printf ("[tversion] MPIR: header %d.%d.%d, library %s\n", __MPIR_VERSION, __MPIR_VERSION_MINOR, __MPIR_VERSION_PATCHLEVEL, mpir_version); #else #ifdef MPFR_USE_MINI_GMP printf ("[tversion] mini-gmp\n"); #else printf ("[tversion] GMP: header %d.%d.%d, library %s\n", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL, gmp_version); #endif #endif /* The following output is also useful under Unix, where one should get: WinDLL: __GMP_LIBGMP_DLL = 0, MPFR_WIN_THREAD_SAFE_DLL = undef If this is not the case, something is probably broken. We cannot test automatically as some MS Windows implementations may declare some Unix (POSIX) compatibility; for instance, Cygwin32 defines __unix__ (but Cygwin64 does not, probably because providing both MS Windows API and POSIX API is not possible with a 64-bit ABI, since MS Windows is LLP64 and Unix is LP64). */ printf ("[tversion] WinDLL: __GMP_LIBGMP_DLL = " #if defined(__GMP_LIBGMP_DLL) MAKE_STR(__GMP_LIBGMP_DLL) #else "undef" #endif ", MPFR_WIN_THREAD_SAFE_DLL = " #if defined(MPFR_WIN_THREAD_SAFE_DLL) MAKE_STR(MPFR_WIN_THREAD_SAFE_DLL) #else "undef" #endif "\n"); if ( #ifdef MPFR_USE_THREAD_SAFE ! #endif mpfr_buildopt_tls_p ()) { printf ("ERROR! mpfr_buildopt_tls_p() and macros" " do not match!\n"); err = 1; } if ( #ifdef MPFR_WANT_FLOAT128 ! #endif mpfr_buildopt_float128_p ()) { printf ("ERROR! mpfr_buildopt_float128_p() and macros" " do not match!\n"); err = 1; } if ( #ifdef MPFR_WANT_DECIMAL_FLOATS ! #endif mpfr_buildopt_decimal_p ()) { printf ("ERROR! mpfr_buildopt_decimal_p() and macros" " do not match!\n"); err = 1; } if ( #if defined(MPFR_HAVE_GMP_IMPL) || defined(WANT_GMP_INTERNALS) ! #endif mpfr_buildopt_gmpinternals_p ()) { printf ("ERROR! mpfr_buildopt_gmpinternals_p() and macros" " do not match!\n"); err = 1; } printf ("[tversion] TLS = %s, float128 = %s, decimal = %s," " GMP internals = %s\n", mpfr_buildopt_tls_p () ? "yes" : "no", mpfr_buildopt_float128_p () ? "yes" : "no", mpfr_buildopt_decimal_p () ? "yes" : "no", mpfr_buildopt_gmpinternals_p () ? "yes" : "no"); printf ("[tversion] intmax_t = " #if defined(_MPFR_H_HAVE_INTMAX_T) "yes" #else "no" #endif ", printf = " #if defined(HAVE_STDARG) && !defined(MPFR_USE_MINI_GMP) "yes" #else "no" #endif "\n"); printf ("[tversion] gmp_printf: hhd = " #if defined(NPRINTF_HH) "no" #else "yes" #endif ", lld = " #if defined(NPRINTF_LL) "no" #else "yes" #endif ", jd = " #if defined(NPRINTF_J) "no" #else "yes" #endif ", td = " #if defined(NPRINTF_T) "no" #elif defined(PRINTF_T) "yes" #else "?" #endif ", Ld = " #if defined(NPRINTF_L) "no" #elif defined(PRINTF_L) "yes" #else "?" #endif "\n"); if (strcmp (mpfr_buildopt_tune_case (), MPFR_TUNE_CASE) != 0) { printf ("ERROR! mpfr_buildopt_tune_case() and MPFR_TUNE_CASE" " do not match!\n %s\n %s\n", mpfr_buildopt_tune_case (), MPFR_TUNE_CASE); err = 1; } else printf ("[tversion] MPFR tuning parameters from %s\n", MPFR_TUNE_CASE); if (strcmp (mpfr_get_patches (), "") != 0) printf ("[tversion] MPFR patches: %s\n", mpfr_get_patches ()); tests_start_mpfr (); if (locale != NULL) printf ("[tversion] Locale: %s\n", locale); /* The memory limit should not be changed for "make check". The warning below signals a possible user mistake. Do not use "%zu" because it is not available in C90; the type mpfr_ueexp_t should be sufficiently large. */ if (tests_memory_limit != DEFAULT_MEMORY_LIMIT) printf ("[tversion] Warning! Memory limit changed to %" MPFR_EXP_FSPEC "u\n", (mpfr_ueexp_t) tests_memory_limit); tests_end_mpfr (); return err; }