@ -1,11 +1,17 @@ | |||||
CXX= clang++ | |||||
CXXFLAGS= --std=c++2a | |||||
CXX= clang++-8 | |||||
CXXFLAGS= --std=c++17 -fprofile-instr-generate -fcoverage-mapping | |||||
all: tests | all: tests | ||||
tests: bin/tests | tests: bin/tests | ||||
./bin/tests | |||||
LLVM_PROFILE_FILE="./bin/tests.profraw" ./bin/tests | |||||
@llvm-profdata merge -sparse ./bin/tests.profraw -o ./bin/tests.profdata | |||||
@llvm-cov report ./bin/tests -instr-profile=./bin/tests.profdata $(wildcard ./tests/*.cpp) include/*.hpp | |||||
@llvm-cov report ./bin/tests -instr-profile=./bin/tests.profdata $(wildcard ./tests/*.cpp) include/*.hpp | tail -n 1 | tr -s "\t" | awk '{print "$8" }' | |||||
bin/tests: tests.cpp $(wildcard tests/*.cpp) | |||||
bin/tests: tests.cpp $(wildcard tests/*.cpp) ./tests/test_scaffold.h | |||||
@mkdir -p $(@D) | @mkdir -p $(@D) | ||||
$(CXX) $(CXXFLAGS) -Itests -Iinclude tests.cpp -o $@ | |||||
$(CXX) $(CXXFLAGS) -Itests -Iinclude tests.cpp -o $@ | |||||
clean: ./bin | |||||
@rm -rf $< |
@ -1,2 +1,56 @@ | |||||
#pragma once | #pragma once | ||||
#include <fcntl.h> | |||||
#include <unistd.h> | |||||
#include <sys/mman.h> | |||||
#include <sys/stat.h> | |||||
#include <string> | |||||
namespace gp{ | |||||
using open_opt_flags = int; | |||||
enum class open_options : open_opt_flags { | |||||
append = O_APPEND, | |||||
create = O_CREAT, | |||||
async = O_ASYNC, | |||||
direct = O_DIRECT, | |||||
data_sync = O_DSYNC, | |||||
file_sync = O_SYNC, | |||||
exclusive = O_EXCL, | |||||
no_access_time = O_NOATIME, | |||||
no_follow = O_NOFOLLOW, | |||||
#ifdef O_TEMP | |||||
temporary = O_TEMP, | |||||
#endif | |||||
#ifdef O_TRUC | |||||
truncate = O_TRUC, | |||||
#endif | |||||
}; | |||||
using open_opt_mode = int; | |||||
enum class open_modes : open_opt_mode { | |||||
user_read = S_IRUSR, | |||||
user_write = S_IWUSR, | |||||
user_exec = S_IXUSR, | |||||
group_read = S_IRGRP, | |||||
group_write = S_IWGRP, | |||||
group_exec = S_IXGRP, | |||||
other_read = S_IROTH, | |||||
other_write = S_IWOTH, | |||||
other_exec = S_IXOTH, | |||||
set_uid = S_ISUID, | |||||
set_gid = S_ISGID, | |||||
sticky_bit = S_ISVTX, | |||||
}; | |||||
class shared_fd { | |||||
const int fd; | |||||
shared_fd(int fd_v) | |||||
: fd(fd_v) {} | |||||
public: | |||||
static shared_fd open(const std::string& filename, const open_opt_flags& flags) { | |||||
} | |||||
}; | |||||
} |