Last change
on this file since 3671 was 3498, checked in by Bruno Cornec, 9 years ago |
- Adds a mr_sys module for the mr_system function and a unit test
|
-
Property svn:eol-style
set to
native
|
File size:
680 bytes
|
Line | |
---|
1 | /*
|
---|
2 | * $Id$
|
---|
3 | *
|
---|
4 | * Test program for mr_stresc
|
---|
5 | * Can be used on host system with valgrind easier than with mondorestore
|
---|
6 | */
|
---|
7 | #include <stdio.h>
|
---|
8 | #include <stdlib.h>
|
---|
9 | #include <unistd.h>
|
---|
10 | #include <sys/types.h>
|
---|
11 | #include <dirent.h>
|
---|
12 | #include "mr_sys.h"
|
---|
13 |
|
---|
14 | void (*mr_cleanup)(void) = NULL;
|
---|
15 |
|
---|
16 | #define TEMPDIR "/tmp/test-mr_sys"
|
---|
17 |
|
---|
18 | int main() {
|
---|
19 |
|
---|
20 | int i;
|
---|
21 | DIR *d = NULL;
|
---|
22 |
|
---|
23 | i= mr_system("mkdir -p %s",TEMPDIR);
|
---|
24 | if (i != 0) {
|
---|
25 | printf("Unable to create the temp dir\n");
|
---|
26 | exit(i);
|
---|
27 | }
|
---|
28 | d = opendir(TEMPDIR);
|
---|
29 | if (d == NULL) {
|
---|
30 | printf("temp dir not created\n");
|
---|
31 | exit(-1);
|
---|
32 | }
|
---|
33 | closedir(d);
|
---|
34 | i = rmdir(TEMPDIR);
|
---|
35 | if (i != 0) {
|
---|
36 | printf("Unable to remove the temp dir\n");
|
---|
37 | exit(i);
|
---|
38 | }
|
---|
39 |
|
---|
40 | exit(0);
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.