summaryrefslogtreecommitdiff
path: root/tests/pthread.l
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2017-02-07 21:14:04 +0800
committerWill Estes <westes575@gmail.com>2017-02-16 09:33:35 -0500
commit122e58965acaf67386d1fc6893f069bd27e5aa26 (patch)
treedebd9abd3046c080f407cb374694790b54d54780 /tests/pthread.l
parent2e820b6015a56552d7f7adb335b5830883d2973c (diff)
test: skip pthread test when needed files missing.
"Unlisting" the pthread test when libpthread is not available is never a good idea. Should let it compile into a stub program that returns the "skip" status. configure.ac and tests/Makefile.am are edited so that pthread test can be built anyway, but only works (not as the stub) when both pthread.h and libpthread are detected on the system. Also fix a small typo in tests/pthread.l comments.
Diffstat (limited to 'tests/pthread.l')
-rw-r--r--tests/pthread.l18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/pthread.l b/tests/pthread.l
index 3f449d2..eb99778 100644
--- a/tests/pthread.l
+++ b/tests/pthread.l
@@ -27,7 +27,7 @@
We create N_THREADS number of threads. Each thread has it's own scanner.
Each thread selects one of the files specified in ARGV, scans it, then
- closes it. This is repeated N_SCANS numebr of times for each thread.
+ closes it. This is repeated N_SCANS number of times for each thread.
The idea is to press the scanner to break under threads.
If we see "Scanner Jammed", then we know
@@ -90,18 +90,18 @@ static int process_text(char* s, yyscan_t scanner)
int main(int ARGC, char *ARGV[]);
-#ifndef HAVE_LIBPTHREAD
- int main (int ARGC, char *ARGV[]) {
- printf(
+#ifndef HAVE_PTHREAD_H
+int main (int ARGC, char *ARGV[]) {
+ puts(
"TEST ABORTED because pthread library not available \n"
- "-- This is expected on some systems. It is not a flex error.\n" );
- return 0;
- }
+ "-- This is expected on some systems. It is not a flex error.");
+ /* Exit status for a skipped test */
+ return 77;
+}
#else
#define N_THREADS 4
#define N_SCANS 20
-#define INPUT_FILE "test.input"
/* Each thread selects the next file to scan in round-robin fashion.
If there are less files than threads, some threads may block. */
@@ -204,5 +204,5 @@ int main (int ARGC, char *ARGV[])
return 0;
}
-#endif /* HAVE_LIBPTHREAD */
+#endif /* HAVE_PTHREAD_H */