]> Git Repo - qemu.git/blobdiff - tests/linux-test.c
Makefile.target: Remove out of date comment
[qemu.git] / tests / linux-test.c
index 31daa9f2bd5d5a88467b7a7577b563bfde1a8348..2e4a746ac3b94311a5717528a8750019c2f37b6e 100644 (file)
@@ -14,8 +14,7 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #include <stdarg.h>
 #include <stdlib.h>
@@ -64,7 +63,7 @@ int __chk_error(const char *filename, int line, int ret)
     return ret;
 }
 
-#define error(fmt, args...) error1(__FILE__, __LINE__, fmt, ##args)
+#define error(fmt, ...) error1(__FILE__, __LINE__, fmt, ## __VA_ARGS__)
 
 #define chk_error(ret) __chk_error(__FILE__, __LINE__, (ret))
 
@@ -93,11 +92,11 @@ void test_file(void)
 
     if (getcwd(cur_dir, sizeof(cur_dir)) == NULL)
         error("getcwd");
-   
+
     chk_error(mkdir(TESTPATH, 0755));
-   
+
     chk_error(chdir(TESTPATH));
-   
+
     /* open/read/write/close/readv/writev/lseek */
 
     fd = chk_error(open("file1", O_WRONLY | O_TRUNC | O_CREAT, 0644));
@@ -124,7 +123,7 @@ void test_file(void)
         error("read");
     if (memcmp(buf, buf2, FILE_BUF_SIZE) != 0)
         error("memcmp");
-   
+
 #define FOFFSET 16
     ret = chk_error(lseek(fd, FOFFSET, SEEK_SET));
     if (ret != 16)
@@ -138,7 +137,7 @@ void test_file(void)
         error("readv");
     if (memcmp(buf + FOFFSET, buf3, FILE_BUF_SIZE - FOFFSET) != 0)
         error("memcmp");
-   
+
     chk_error(close(fd));
 
     /* access */
@@ -171,18 +170,18 @@ void test_file(void)
     chk_error(ftruncate(fd, 50));
     chk_error(fstat(fd, &st));
     chk_error(close(fd));
-   
+
     if (st.st_size != 50)
         error("stat size");
     if (!S_ISREG(st.st_mode))
         error("stat mode");
-   
+
     /* symlink/lstat */
     chk_error(symlink("file2", "file3"));
     chk_error(lstat("file3", &st));
     if (!S_ISLNK(st.st_mode))
         error("stat mode");
-   
+
     /* getdents */
     dir = opendir(TESTPATH);
     if (!dir)
@@ -241,7 +240,7 @@ void test_time(void)
     ti = tv2.tv_sec - tv.tv_sec;
     if (ti >= 2)
         error("gettimeofday");
-   
+
     chk_error(getrusage(RUSAGE_SELF, &rusg1));
     for(i = 0;i < 10000; i++);
     chk_error(getrusage(RUSAGE_SELF, &rusg2));
@@ -327,7 +326,7 @@ void test_socket(void)
     chk_error(getsockopt(server_fd, SOL_SOCKET, SO_TYPE, &val, &len));
     if (val != SOCK_STREAM)
         error("getsockopt");
-   
+
     pid = chk_error(fork());
     if (pid == 0) {
         client_fd = client_socket();
@@ -427,7 +426,9 @@ void test_clone(void)
                            CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello2"));
 
     while (waitpid(pid1, &status1, 0) != pid1);
+    free(stack1);
     while (waitpid(pid2, &status2, 0) != pid2);
+    free(stack2);
     if (thread1_res != 5 ||
         thread2_res != 6)
         error("clone");
@@ -465,7 +466,7 @@ void test_signal(void)
     sigemptyset(&act.sa_mask);
     act.sa_flags = 0;
     chk_error(sigaction(SIGALRM, &act, NULL));
-   
+
     it.it_interval.tv_sec = 0;
     it.it_interval.tv_usec = 10 * 1000;
     it.it_value.tv_sec = 0;
@@ -475,7 +476,7 @@ void test_signal(void)
     if (oit.it_value.tv_sec != it.it_value.tv_sec ||
         oit.it_value.tv_usec != it.it_value.tv_usec)
         error("itimer");
-   
+
     while (alarm_count < 5) {
         usleep(10 * 1000);
     }
@@ -498,7 +499,7 @@ void test_signal(void)
     if (setjmp(jmp_env) == 0) {
         *(uint8_t *)0 = 0;
     }
-   
+
     act.sa_handler = SIG_DFL;
     sigemptyset(&act.sa_mask);
     act.sa_flags = 0;
This page took 0.024692 seconds and 4 git commands to generate.