commit 33bb5385f14d981c3f9c2d4bc1a39b79c76c6a44
Author: David Sorber <david.sorber@gmail.com>
Date:   Fri Jul 8 15:10:21 2022 -0400

    read_test: Add optional comment block to output input data one chunk per
    file. This can be used to verify that the output data matches the input
    data.

diff --git a/software/read_test/src/AIO_ExecDriver.cc b/software/read_test/src/AIO_ExecDriver.cc
index 22d88b1..d56add4 100644
--- a/software/read_test/src/AIO_ExecDriver.cc
+++ b/software/read_test/src/AIO_ExecDriver.cc
@@ -101,8 +101,6 @@ void BlackLynx::SearchLynx::AIO_ExecDriver::readerThreadBody(
     Chunk* chunk = nullptr;
     std::string prevFilename("");
     
-//    std::ofstream output("chunk.bin");
-    
     while (true)
     {
         chunk = inQueue->pop_front();
@@ -238,16 +236,9 @@ void BlackLynx::SearchLynx::AIO_ExecDriver::readerThreadBody(
             inFileStream.close();
         }
         
-//        std::string test(chunk->p_chunkData, 30);
-//        BlnxLog(debug) << "CHUNK " << chunk->m_chunkId << " DATA: " << test;
-        
-//        output.write(chunk->p_chunkData, chunk->m_chunkSize);
-
         outQueue->push_back(chunk);
     }
     
-//    output.close();
-    
     // Release file descriptor
     ::close(fd);
     
diff --git a/software/read_test/src/ExecDriver.cc b/software/read_test/src/ExecDriver.cc
index 3a3099b..4a57b66 100644
--- a/software/read_test/src/ExecDriver.cc
+++ b/software/read_test/src/ExecDriver.cc
@@ -10,6 +10,10 @@
 * Unpublished -- all rights reserved under the copyright laws       *
 * of the United States.                                             *
 ********************************************************************/
+#include <iomanip>
+
+#include <sys/stat.h>
+#include <sys/types.h>
 
 #include "ExecDriver.h"
 #include "Utilities/ChunkConstants.h"
@@ -262,6 +266,22 @@ void BlackLynx::SearchLynx::ExecDriver::cleanupThreadBody(
             }
         }
         
+        // Uncomment this to output each chunk's buffer to a file 
+#if 0
+        // Create directory to hold chunk files
+        mkdir("chunks", 0777);
+        
+        // Output each chunk with a filename corresponding to its chunk ID. 
+        // E.g. chunk_235.bin
+        std::ostringstream fname;
+        fname << "chunks/chunk_" << std::setw(3) << std::setfill('0') 
+              << chunk->m_chunkId << ".bin";
+        BlnxLog(error) << "FNAME: " << fname.str();
+        std::ofstream output(fname.str());
+        output.write(chunk->p_chunkData, chunk->m_chunkSize);
+        output.close();
+#endif
+        
         bufAllocator->release(chunk->p_chunkData);
         delete chunk;
     }
