#ifdef TINYTEST_LOCAL
#include "tinytest_local.h"
#endif
+#define TINYTEST_POSTFORK
#include <stdio.h>
#include <stdlib.h>
#ifndef NO_FORKING
+#ifdef TINYTEST_POSTFORK
+void tinytest_postfork(void);
+#else
+static void tinytest_postfork(void) { }
+#endif
+
static enum outcome
testcase_run_forked_(const struct testgroup_t *group,
const struct testcase_t *testcase)
int test_r, write_r;
char b[1];
close(outcome_pipe[0]);
+ tinytest_postfork();
test_r = testcase_run_bare_(testcase);
assert(0<=(int)test_r && (int)test_r<=2);
b[0] = "NYS"[test_r];
return 0;
}
+
+/** Run operations that the crypto library requires to be happy again
+ * after forking. */
+void
+crypto_postfork(void)
+{
+#ifdef ENABLE_NSS
+ crypto_nss_postfork();
+#endif
+}
void crypto_thread_cleanup(void);
int crypto_global_cleanup(void);
+void crypto_postfork(void);
#endif /* !defined(TOR_CRYPTO_H) */
{
NSS_Shutdown();
}
+
+void
+crypto_nss_postfork(void)
+{
+ crypto_nss_global_cleanup();
+ crypto_nss_early_init();
+}
int crypto_nss_late_init(void);
void crypto_nss_global_cleanup(void);
+
+void crypto_nss_postfork(void);
#endif
#endif /* !defined(TOR_CRYPTO_NSS_H) */
tinytest_set_test_failed_();
}
+void tinytest_postfork(void);
+void
+tinytest_postfork(void)
+{
+ crypto_postfork();
+}
+
/** Main entry point for unit test code: parse the command line, and run
* some unit tests. */
int