static void validate_export(nfs_export *exp) { /* Check that the given export point is potentially exportable. * We just give warnings here, don't cause anything to fail. * If a path doesn't exist, or is not a dir or file, give an warning * otherwise trial-export to '-test-client-' and check for failure. */ struct stat stb; char *path = exp->m_export.e_path; struct statfs64 stf; int fs_has_fsid = 0; if (stat(path, &stb) < 0) { xlog(L_ERROR, "Failed to stat %s: %m", path); return; } if (!S_ISDIR(stb.st_mode) && !S_ISREG(stb.st_mode)) { xlog(L_ERROR, "%s is neither a directory nor a file. " "Remote access will fail", path); return; } if (!can_test()) return; if (!statfs64(path, &stf) && (stf.f_fsid.__val[0] || stf.f_fsid.__val[1])) fs_has_fsid = 1; if ((exp->m_export.e_flags & NFSEXP_FSID) || exp->m_export.e_uuid || fs_has_fsid) { if ( !test_export(path, 1)) { xlog(L_ERROR, "%s does not support NFS export", path); return; } } else if ( ! test_export(path, 0)) { if (test_export(path, 1)) xlog(L_ERROR, "%s requires fsid= for NFS export", path); else xlog(L_ERROR, "%s does not support NFS export", path); return; } }
int main(int argc , char ** argv) { ecl_grid_type * ecl_grid = ecl_grid_alloc_rectangular( 9 , 9 , 2 , 1 , 1 , 1 , NULL ); ecl_kw_type * fault_blk_kw = ecl_kw_alloc("FAULTBLK" , ecl_grid_get_global_size( ecl_grid ) , ECL_INT_TYPE ); test_create( ecl_grid , fault_blk_kw ); test_create_invalid( ecl_grid ); test_trace_edge( ecl_grid ); test_export(ecl_grid); test_neighbours( ecl_grid ); ecl_grid_free( ecl_grid ); ecl_kw_free( fault_blk_kw ); exit(0); }
int main (int argc, char **argv) { #ifdef ENABLE_CRYPTO const char *datadir = "data/pgp"; GMimeStream *istream, *ostream; GMimeFilterOpenPGP *filter; GMimeCryptoContext *ctx; const char *what; char *gpg, *key; struct stat st; int i; g_mime_init (); testsuite_init (argc, argv); if (!(gpg = g_find_program_in_path ("gpg2"))) if (!(gpg = g_find_program_in_path ("gpg"))) return EXIT_FAILURE; if (testsuite_setup_gpghome (gpg) != 0) return EXIT_FAILURE; g_free (gpg); for (i = 1; i < argc; i++) { if (argv[i][0] != '-') { datadir = argv[i]; break; } } if (i < argc && (stat (datadir, &st) == -1 || !S_ISDIR (st.st_mode))) return 0; testsuite_start ("GnuPG crypto context"); ctx = g_mime_gpg_context_new (); g_mime_crypto_context_set_request_password (ctx, request_passwd); testsuite_check ("GMimeGpgContext::import"); try { key = g_build_filename (datadir, "gmime.gpg.pub", NULL); import_key (ctx, key); g_free (key); key = g_build_filename (datadir, "gmime.gpg.sec", NULL); import_key (ctx, key); g_free (key); testsuite_check_passed (); } catch (ex) { testsuite_check_failed ("GMimeGpgContext::import failed: %s", ex->message); return EXIT_FAILURE; } finally; key = g_build_filename (datadir, "gmime.gpg.pub", NULL); testsuite_check ("GMimeGpgContext::export"); try { test_export (ctx, key); testsuite_check_passed (); } catch (ex) { testsuite_check_failed ("GMimeGpgContext::export failed: %s", ex->message); } finally; g_free (key); istream = g_mime_stream_mem_new (); ostream = g_mime_stream_mem_new (); g_mime_stream_write_string (istream, "this is some cleartext\r\n"); g_mime_stream_reset (istream); what = "GMimeGpgContext::sign"; testsuite_check ("%s", what); try { test_sign (ctx, FALSE, istream, ostream); testsuite_check_passed (); what = "GMimeGpgContext::verify"; testsuite_check ("%s", what); g_mime_stream_reset (istream); g_mime_stream_reset (ostream); test_verify (ctx, istream, ostream); testsuite_check_passed (); } catch (ex) { testsuite_check_failed ("%s failed: %s", what, ex->message); } finally; g_object_unref (ostream); g_mime_stream_reset (istream); ostream = g_mime_stream_mem_new (); what = "GMimeGpgContext::sign (detached)"; testsuite_check ("%s", what); try { test_sign (ctx, TRUE, istream, ostream); testsuite_check_passed (); what = "GMimeGpgContext::verify (detached)"; testsuite_check ("%s", what); g_mime_stream_reset (istream); g_mime_stream_reset (ostream); test_verify_detached (ctx, istream, ostream); testsuite_check_passed (); } catch (ex) { testsuite_check_failed ("%s failed: %s", what, ex->message); } finally; g_object_unref (ostream); g_mime_stream_reset (istream); ostream = g_mime_stream_mem_new (); what = "GMimeGpgContext::encrypt"; testsuite_check ("%s", what); try { test_encrypt (ctx, FALSE, istream, ostream); testsuite_check_passed (); what = "GMimeGpgContext::decrypt"; testsuite_check ("%s", what); g_mime_stream_reset (istream); g_mime_stream_reset (ostream); test_decrypt (ctx, FALSE, istream, ostream); testsuite_check_passed (); } catch (ex) { testsuite_check_failed ("%s failed: %s", what, ex->message); } finally; g_object_unref (ostream); g_mime_stream_reset (istream); ostream = g_mime_stream_mem_new (); what = "GMimeGpgContext::encrypt+sign"; testsuite_check ("%s", what); try { test_encrypt (ctx, TRUE, istream, ostream); testsuite_check_passed (); what = "GMimeGpgContext::decrypt+verify"; testsuite_check ("%s", what); g_mime_stream_reset (istream); g_mime_stream_reset (ostream); test_decrypt (ctx, TRUE, istream, ostream); testsuite_check_passed (); } catch (ex) { testsuite_check_failed ("%s failed: %s", what, ex->message); } finally; g_object_unref (istream); g_object_unref (ostream); g_object_unref (ctx); filter = (GMimeFilterOpenPGP *) g_mime_filter_openpgp_new (); what = "GMimeFilterOpenPGP::public key block"; testsuite_check ("%s", what); try { key = g_build_filename (datadir, "gmime.gpg.pub", NULL); test_openpgp_filter (filter, key, GMIME_OPENPGP_DATA_PUBLIC_KEY, 0, 1720); g_free (key); testsuite_check_passed (); } catch (ex) { testsuite_check_failed ("%s failed: %s", what, ex->message); } finally; g_mime_filter_reset ((GMimeFilter *) filter); what = "GMimeFilterOpenPGP::private key block"; testsuite_check ("%s", what); try { key = g_build_filename (datadir, "gmime.gpg.sec", NULL); test_openpgp_filter (filter, key, GMIME_OPENPGP_DATA_PRIVATE_KEY, 0, 1928); g_free (key); testsuite_check_passed (); } catch (ex) { testsuite_check_failed ("%s failed: %s", what, ex->message); } finally; g_mime_filter_reset ((GMimeFilter *) filter); what = "GMimeFilterOpenPGP::signed message block"; testsuite_check ("%s", what); try { key = g_build_filename (datadir, "signed-message.txt", NULL); test_openpgp_filter (filter, key, GMIME_OPENPGP_DATA_SIGNED, 162, 440); g_free (key); testsuite_check_passed (); } catch (ex) { testsuite_check_failed ("%s failed: %s", what, ex->message); } finally; g_mime_filter_reset ((GMimeFilter *) filter); what = "GMimeFilterOpenPGP::encrypted message block"; testsuite_check ("%s", what); try { key = g_build_filename (datadir, "encrypted-message.txt", NULL); test_openpgp_filter (filter, key, GMIME_OPENPGP_DATA_ENCRYPTED, 165, 1084); g_free (key); testsuite_check_passed (); } catch (ex) { testsuite_check_failed ("%s failed: %s", what, ex->message); } finally; g_object_unref (filter); testsuite_end (); g_mime_shutdown (); if (testsuite_destroy_gpghome () != 0) return EXIT_FAILURE; return testsuite_exit (); #else fprintf (stderr, "PGP support not enabled in this build.\n"); return EXIT_SUCCESS; #endif }