Commit a58ef08a authored by Marc Vef's avatar Marc Vef
Browse files

ifs_test: Added temp testing for I/O stuff

parent 105458a0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -10,7 +10,9 @@ include_directories(${MPI_INCLUDE_PATH})

set(SOURCE_FILES main.cpp)
set(SOURCE_FILES_MPI main_MPI.cpp)
set(SOURCE_FILES_TEMP main_temp_testing.cpp)
add_executable(ifs_test ${SOURCE_FILES})
add_executable(ifs_test_MPI ${SOURCE_FILES_MPI})
add_executable(ifs_test_temp ${SOURCE_FILES_TEMP})

target_link_libraries(ifs_test_MPI ${MPI_C_LIBRARIES})
 No newline at end of file
+0 −25
Original line number Diff line number Diff line
#include <iostream>
#include <fcntl.h>
#include <unistd.h>
#include <chrono>
#include <cstring>

using namespace std;

@@ -21,29 +19,6 @@ int main(int argc, char* argv[]) {
//    cout << stat("/tmp/mountdir/creat.txt", &attr) << endl;
//    cout << unlink("/tmp/mountdir/creat.txt") << endl;

//    char buf[] = "test123\n";
//    string p = "/tmp/mountdir/file"s;
//    auto fd = open(p.c_str(), O_CREAT|O_WRONLY, 0777);
//    auto nw = write(fd, &buf, strlen(buf));
//    close(fd);
//
//    fd = open(p.c_str(), O_RDONLY, 0777);
//    char buf_read[9] = {0};
//    auto rs = read(fd, &buf_read, strlen(buf));
//    buf_read[8] = '\0';
//    printf("buffer read: %s\n", buf_read);
//    close(fd);

//    auto fd2 = open("/tmp/rootdir/data/chunks/file/data2", O_RDONLY, 0777);
//    char buf_read2[9] = {0};
//    auto rs2 = read(fd2, &buf_read2, 8);
//    close(fd2);
//    buf_read2[8] = '\0';
//
//    string bla = buf_read2;
//    cout << bla << endl;



    auto start_t = get_time::now();

+34 −0
Original line number Diff line number Diff line
#include <iostream>
#include <fcntl.h>
#include <unistd.h>
#include <cstring>

using namespace std;

int main(int argc, char* argv[]) {

    char buf[] = "test123\n";
    string p = "/tmp/mountdir/file"s;
    auto fd = open(p.c_str(), O_CREAT | O_WRONLY, 0777);
    auto nw = write(fd, &buf, strlen(buf));
    close(fd);

    fd = open(p.c_str(), O_RDONLY, 0777);
    char buf_read[9] = {0};
    auto rs = read(fd, &buf_read, strlen(buf));
    buf_read[8] = '\0';
    printf("buffer read: %s\n", buf_read);
    close(fd);

    //    auto fd2 = open("/tmp/rootdir/data/chunks/file/data2", O_RDONLY, 0777);
//    char buf_read2[9] = {0};
//    auto rs2 = read(fd2, &buf_read2, 8);
//    close(fd2);
//    buf_read2[8] = '\0';
//
//    string bla = buf_read2;
//    cout << bla << endl;

    return 0;

}
 No newline at end of file