[PATCH] D17639: [asan] Fix recvfrom.cc testcase failure in large parallel tests run.

Yury Gribov via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 26 03:10:03 PST 2016


ygribov added inline comments.

================
Comment at: test/asan/TestCases/Linux/recvfrom.cc:50
@@ -43,3 +49,3 @@
 int main() {
   char buf[kBufSize] = "123456789";
   struct sockaddr_in serveraddr; // server's addr
----------------
Why not just init this with all zeros? Currently you implicitly rely on the fact that strlen("123456789") > kBufSize/2 which seems to be unnecessary.

================
Comment at: test/asan/TestCases/Linux/recvfrom.cc:51
@@ -44,3 +50,3 @@
   char buf[kBufSize] = "123456789";
   struct sockaddr_in serveraddr; // server's addr
 
----------------
I'm not sure you need trivial comments (especially given the self-descriptive name of the variable).

================
Comment at: test/asan/TestCases/Linux/recvfrom.cc:55
@@ -48,3 +54,3 @@
   if (pthread_create(&server_thread, NULL, server_thread_udp, NULL)) {
     fprintf(stderr, "Error creating thread\n");
     exit(1);
----------------
Format of messages varies across fprintfs. Probably makes sense to unify them (e.g. by wrapping fprintf + exit into a macro).

================
Comment at: test/asan/TestCases/Linux/recvfrom.cc:60
@@ -53,3 +59,3 @@
   int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
   struct hostent *server;
   char hostname[] = "localhost";
----------------
You don't seem to use this.

================
Comment at: test/asan/TestCases/Linux/recvfrom.cc:63
@@ -56,3 +62,3 @@
   if (sockfd < 0)
     fprintf(stderr, "ERROR opening socket\n");
 
----------------
Shouldn't you abort here?

================
Comment at: test/asan/TestCases/Linux/recvfrom.cc:71
@@ -64,3 +70,3 @@
 
   memset((char *) &serveraddr, 0, sizeof(serveraddr));
   serveraddr.sin_family = AF_INET;
----------------
Spurious white before &? Same issue in other places.


Repository:
  rL LLVM

http://reviews.llvm.org/D17639





More information about the llvm-commits mailing list