mirror of
https://github.com/apache/nuttx.git
synced 2026-09-28 15:54:57 +08:00
Added redirection test
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@790 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
|
||||
ASRCS =
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
CSRCS = pipe_main.c transfer_test.c interlock_test.c
|
||||
CSRCS = pipe_main.c transfer_test.c interlock_test.c redirect_test.c
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
|
||||
@@ -97,7 +97,10 @@ static void *null_writer(pthread_addr_t pvarg)
|
||||
/* Then close the FIFO */
|
||||
|
||||
printf("null_writer: Closing %s\n", FIFO_PATH2);
|
||||
close(fd);
|
||||
if (close(fd) != 0)
|
||||
{
|
||||
fprintf(stderr, "null_writer: close failed: %d\n", errno);
|
||||
}
|
||||
sleep(5);
|
||||
|
||||
printf("null_writer: Returning success\n");
|
||||
@@ -177,7 +180,10 @@ int interlock_test(void)
|
||||
/* Close the file */
|
||||
|
||||
printf("interlock_test: Closing %s\n", FIFO_PATH2);
|
||||
close(fd);
|
||||
if (close(fd) != 0)
|
||||
{
|
||||
fprintf(stderr, "interlock_test: close failed: %d\n", errno);
|
||||
}
|
||||
|
||||
/* Wait for null_writer thread to complete */
|
||||
|
||||
@@ -204,7 +210,10 @@ int interlock_test(void)
|
||||
return 0;
|
||||
|
||||
errout_with_file:
|
||||
close(fd);
|
||||
if (close(fd) != 0)
|
||||
{
|
||||
fprintf(stderr, "interlock_test: close failed: %d\n", errno);
|
||||
}
|
||||
errout_with_thread:
|
||||
pthread_detach(writerid);
|
||||
pthread_cancel(writerid);
|
||||
|
||||
@@ -51,6 +51,10 @@
|
||||
#define FIFO_PATH1 "/tmp/testfifo-1"
|
||||
#define FIFO_PATH2 "/tmp/testfifo-2"
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_PIPE_STACKSIZE
|
||||
# define CONFIG_EXAMPLES_PIPE_STACKSIZE 1024
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
@@ -65,5 +69,6 @@
|
||||
|
||||
extern int transfer_test(int fdin, int fdout);
|
||||
extern int interlock_test(void);
|
||||
extern int redirection_test(void);
|
||||
|
||||
#endif /* __EXAMPLES_PIPE_PIPE_H */
|
||||
|
||||
+39
-154
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user