Skip to content
This repository was archived by the owner on Jul 27, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
d2e0ef5
generate protobuf for c bindings.
monnand Jan 20, 2014
ff14b00
status
monnand Jan 20, 2014
2e19a44
container and container api.
monnand Jan 21, 2014
dc2e4aa
Basic structure of C binding.
monnand Jan 21, 2014
6028583
lmctfy-c.o depends on lmctfy.pb-c.h
monnand Jan 21, 2014
cb69f01
release container api
monnand Jan 21, 2014
9daa43b
get container.
monnand Jan 21, 2014
cdb5013
get container
monnand Jan 21, 2014
740c6bb
status_new()
monnand Jan 22, 2014
2e2b8b4
status is no longer a return value.
monnand Jan 22, 2014
b74b9a8
status is an argument.
monnand Jan 22, 2014
4abc0f7
comments.
monnand Jan 22, 2014
795c4e9
create_container()
monnand Jan 22, 2014
e081552
create_container()
monnand Jan 22, 2014
b530597
rename
monnand Jan 25, 2014
8ea9a41
make status as simple as possible
monnand Jan 25, 2014
e9145f6
removed status-c.h
monnand Jan 25, 2014
54e6572
comment.
monnand Jan 25, 2014
10bc748
use new instead of malloc() in C++ code.
monnand Jan 25, 2014
be902eb
rename a function.
monnand Jan 25, 2014
e5e566c
delete api.
monnand Jan 25, 2014
c62b720
put *_raw functions into a separate header.
monnand Jan 25, 2014
fdf3ca6
Rename some variables. Output to bin/
monnand Jan 27, 2014
c109cba
create gtest.a in Makefile.
monnand Jan 27, 2014
04b3c09
working on unit tests.
monnand Jan 27, 2014
ada5231
Use () instead of {} in Makefile
monnand Jan 27, 2014
820b9bc
A better Makefile.
monnand Jan 27, 2014
a53a342
merge clmctfy Makefile into the top-level Makefile.
monnand Jan 27, 2014
bb4b213
remove old Makefile in clmctfy
monnand Jan 27, 2014
c8070dc
1st unit test passed.
monnand Jan 28, 2014
f71c518
refined the test case.
monnand Jan 28, 2014
aed2727
unit test for create_container()
monnand Jan 28, 2014
03a2372
Delete container on tear down.
monnand Jan 28, 2014
193e035
destroy() container in tear down.
monnand Jan 28, 2014
3610cd6
test container name in unit test.
monnand Jan 28, 2014
8225bc7
detect container: impl & test.
monnand Jan 28, 2014
523c418
move struct def into internal.h
monnand Jan 28, 2014
16b18e4
add unit tests on failure.
monnand Jan 28, 2014
20fe25d
unit test for container exec().
monnand Jan 28, 2014
9d3a12c
Check the parameters.
monnand Jan 28, 2014
98dcf24
Invalid argument test for container exec().
monnand Jan 28, 2014
57659f8
container update()
monnand Jan 28, 2014
5556a09
unit test for update()
monnand Jan 28, 2014
f1473b5
merge unit tests.
monnand Jan 29, 2014
7575a0f
check status first to propagate error.
monnand Feb 4, 2014
6c2f21e
lmctfy_container_enter()
monnand Feb 5, 2014
7d4ab94
lcmtfy_container_run()
monnand Feb 5, 2014
7fccb69
For .ctest.cc, open -fpermissive.
monnand Feb 5, 2014
c56a45b
use macros to write unit test.
monnand Feb 6, 2014
0ce03bd
remove comments.
monnand Feb 6, 2014
b863563
use macros in unit test.
monnand Feb 6, 2014
b3b60e4
more complete test cases.
monnand Feb 6, 2014
7386f4f
lmctfy_container_spec()
monnand Feb 6, 2014
882266e
lmctfy_container_list_subcontainers()
monnand Feb 8, 2014
53b19fa
lmctfy_list_processes/threads()
monnand Feb 8, 2014
1418aa1
register_nitification()
monnand Feb 8, 2014
ec915bd
register_notification()
monnand Feb 8, 2014
f623ad2
user_data for callback.
monnand Feb 8, 2014
d8709f3
Done. Need to test.
monnand Feb 8, 2014
cd42f04
EventCallbackWrapper
monnand Feb 9, 2014
da83fd8
simple test cases.
monnand Feb 10, 2014
2d3e7bf
Tested all functions. Need an example.
monnand Feb 10, 2014
18682ab
do not include _ctest.cc in the library.
monnand Feb 14, 2014
074ffb6
detect self
monnand Feb 14, 2014
7d59e75
example using the C APIs.
monnand Feb 14, 2014
8dd1941
Build example for c binding in Makefile.
monnand Feb 14, 2014
376e9b0
change the signatore of lmctfy_container_api_detect()
monnand Feb 25, 2014
4d81313
include "clmctfy-raw.h" in clmctfy_container.cc
monnand Feb 26, 2014
70ff857
Follow the Google coding style.
monnand Mar 11, 2014
3f067af
s/propagete/propagate/g
monnand Mar 11, 2014
efe3d48
comments
monnand Mar 11, 2014
b4f9606
better example.
monnand Mar 12, 2014
a1e266f
changed the order of headers.
monnand Mar 12, 2014
0fa1b94
changed the order of parameters.
monnand Mar 12, 2014
f219fff
comment on create_container_raw()
monnand Mar 12, 2014
9ed0da0
remove unnecessary functions.
monnand Mar 12, 2014
5d36c6b
rearrange file layouts.
monnand Mar 13, 2014
308adee
remove unnecessary code.
monnand Mar 13, 2014
db61f9a
rename a header file.
monnand Mar 13, 2014
60864c7
change the example for clmctfy.
monnand Mar 13, 2014
11c13af
container_api_raw functions
monnand Mar 21, 2014
beeecad
order of #include
monnand Mar 21, 2014
a7fd50f
lmctfy_container_stats_raw()
monnand Mar 22, 2014
4ff0ff2
rebase onto 0.4.5
monnand Apr 19, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 72 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ OPT ?= -O2 -DNDEBUG # (A) Production use (optimized mode)
# Use default if no configuration specified.
CXX ?= g++
AR ?= ar
CC ?= gcc

# Version number of lmctfy.
VERSION = "\"0.4.5\""

# TODO(vmarmol): Ensure our dependencies are installed
PROTOC = protoc
PROTOC_C = protoc-c

# Function for getting a set of source files.
get_srcs = $(shell find $(1) -name \*.cc -a ! -name \*_test.cc | tr "\n" " ")
get_srcs = $(shell find $(1) -name \*.cc -a ! -name \*_test.cc -a ! -name \*_ctest.cc | tr "\n" " ")

INCLUDE_PROTOS = include/virtual_host include/lmctfy include/namespaces
UTIL_PROTOS = util/task/codes
Expand All @@ -37,6 +39,8 @@ LIBLMCTFY_SOURCES =$(shell find lmctfy/ -name \*.cc -a ! -name \*_test.cc \
CLI_SOURCES = $(call get_srcs,lmctfy/cli/)
NSINIT_SOURCES = nscon/init.cc nscon/init_impl.cc
NSCON_SOURCES = $(filter-out $(NSINIT_SOURCES),$(call get_srcs,nscon/))
CPROTOS_SOURCES = $(addsuffix .pb-c.c,$(INCLUDE_PROTOS)) $(addsuffix .pb.cc,$(UTIL_PROTOS))
LIBCLMCTFY_SOURCES = $(call get_srcs,clmctfy/) $(CPROTOS_SOURCES)

# The objects for the system API (both release and test versions).
SYSTEM_API_OBJS = global_utils/mount_utils.o \
Expand All @@ -61,6 +65,7 @@ SYSTEM_API_TEST_OBJS = global_utils/mount_utils_test_util.o \
# Gets all *_test.cc files in lmtcfy/.
TESTS = $(basename $(shell find lmctfy/ nscon/ -name \*_test.cc \
-a ! -name \*_integration_test.cc))
CLMCTFY_TESTS = $(basename $(shell find clmctfy/ -name \*_ctest.cc))

# Where to place the binary outputs.
OUT_DIR = bin
Expand Down Expand Up @@ -96,15 +101,32 @@ CXXFLAGS += -pthread -lrt -lre2 -lgflags
CXXFLAGS += -I. -I./include -I./base -I./lmctfy -I$(GTEST_DIR)/include \
-I$(GMOCK_DIR)/include -I/usr/local/include -L/usr/local/lib \
-I/usr/include -L/usr/lib
# Add include for c binding
CXXFLAGS += -I./clmctfy

# Add proto flags.
CXXFLAGS += `pkg-config --cflags --libs protobuf`

# Add proto-c flags.
CXXFLAGS += -lprotobuf-c

# flags for linker
LDFLAGS = -lprotobuf-c
LDFLAGS += `pkg-config --cflags --libs protobuf`
LDFLAGS += -lpthread
LDFLAGS += -pthread
LDFLAGS += -lrt -lre2 -lgflags -lm

# linker's flag for C bindings
CLDFLAGS = -lstdc++


CLI = lmctfy
NSCON = lmctfy-nscon
NSINIT = lmctfy-nsinit
LIBRARY = liblmctfy.a
CREAPER = lmctfy-creaper
CLIBRARY = libclmctfy.a

# Function for ensuring the output directory has been created.
create_bin = mkdir -p $(dir $(OUT_DIR)/$@)
Expand All @@ -128,6 +150,8 @@ install: all
chmod +x /usr/local/bin/$(NSINIT)
cp ./bin/$(CREAPER) /usr/local/bin
chmod +x /usr/local/bin/$(CREAPER)

cbinding: $(CLIBRARY) checkc

TEST_TMPDIR = "/tmp/lmctfy_test.$$"
check: $(TESTS)
Expand All @@ -141,6 +165,16 @@ check: $(TESTS)
rm -rf $(TEST_TMPDIR)
echo "All tests pass!"

checkc: $(CLMCTFY_TESTS)
for t in $(addprefix $(OUT_DIR)/,$^); \
do \
echo "***** Running $$t"; \
rm -rf $(TEST_TMPDIR); \
mkdir $(TEST_TMPDIR); \
./$$t --test_tmpdir=$(TEST_TMPDIR); \
done; \
rm -rf $(TEST_TMPDIR)

clean:
-rm -rf $(OUT_DIR)
-rm -f `find . -type f -name '*.pb.*'`
Expand All @@ -152,9 +186,16 @@ examples/simple_existing: examples/simple_existing.o $(LIBRARY)
# All common base sources (non-lmctfy and non-nscon).
COMMON_SOURCES = $(INCLUDE_SOURCES) $(BASE_SOURCES) $(STRINGS_SOURCES) \
$(FILE_SOURCES) $(THREAD_SOURCES) $(UTIL_SOURCES)
examples/clmctfy_simple_existing: examples/clmctfy_simple_existing.o $(CLIBRARY)
$(create_bin)
$(CC) -o $(OUT_DIR)/$@ $(addprefix $(OUT_DIR)/,$^) $(LDFLAGS) $(CLDFLAGS)

# All sources needed by the library (minus the system API).
LIBRARY_SOURCES = $(COMMON_SOURCES) $(LIBLMCTFY_SOURCES) $(NSCON_SOURCES)
CLIBRARY_ONLY_SOURCES = $(INCLUDE_SOURCES) $(BASE_SOURCES) $(LIBCLMCTFY_SOURCES) \
$(STRINGS_SOURCES) $(FILE_SOURCES) $(THREAD_SOURCES) \
$(UTIL_SOURCES)
CLIBRARY_SOURCES = $(LIBRARY_SOURCES) $(LIBCLMCTFY_SOURCES)


# The lmctfy library without the system API. This is primarily an internal
Expand All @@ -163,11 +204,19 @@ lmctfy_no_system_api.a: $(call source_to_object,$(LIBRARY_SOURCES))
$(create_bin)
$(archive_all)

clmctfy_only_api.a: $(call source_to_object,$(CLIBRARY_ONLY_SOURCES))
$(create_bin)
$(archive_all)

# The lmctfy library with the real system API.
$(LIBRARY): $(call source_to_object,$(LIBRARY_SOURCES)) $(SYSTEM_API_OBJS)
$(create_bin)
$(archive_all)

$(CLIBRARY): $(call source_to_object,$(CLIBRARY_SOURCES)) $(SYSTEM_API_OBJS)
$(create_bin)
$(archive_all)

# Objects of the lmctfy CLI.
lmctfy_cli.a: $(call source_to_object,$(CLI_SOURCES))
$(create_bin)
Expand Down Expand Up @@ -204,19 +253,41 @@ $(CREAPER): lmctfy-creaper.go
$(CXX) -o $(OUT_DIR)/$@ $*.cc $*_test.cc $(addprefix $(OUT_DIR)/,$^) \
$(CXXFLAGS)

%_ctest: gtest_main.a $(SYSTEM_API_TEST_OBJS) clmctfy_only_api.a
$(create_bin)
$(CXX) -o $(OUT_DIR)/$@ $*.cc $*_ctest.cc $(addprefix $(OUT_DIR)/,$^) \
$(CXXFLAGS) -fpermissive

%_proto: %.proto
$(PROTOC) $^ --cpp_out=.
$(PROTOC_C) $^ --c_out=$(dir $^) --proto_path=$(dir $^):.

%.pb.o: %_proto
$(create_bin)
$(CXX) -c $*.pb.cc -o $(OUT_DIR)/$@ $(CXXFLAGS)

%.pb-c.o: %_proto
$(create_bin)
$(CXX) -c $*.pb-c.c -o $(OUT_DIR)/$@ $(CXXFLAGS) -fpermissive

gen_protos: $(addsuffix _proto,$(INCLUDE_PROTOS) $(UTIL_PROTOS))

%_ctest.o: gen_protos %_ctest.cc
$(create_bin)
$(CXX) -c $*.cc -o $(OUT_DIR)/$@ $(CXXFLAGS) -fpermissive

%.o: gen_protos %.c
$(create_bin)
$(CC) -c $*.c -o $(OUT_DIR)/$@ $(CXXFLAGS)

%.o: gen_protos %.cc
$(create_bin)
$(CXX) -c $*.cc -o $(OUT_DIR)/$@ $(CXXFLAGS)

%.o: %.pb-c.c
$(create_bin)
$(CXX) -c $*.c -o $(OUT_DIR)/$@ $(CXXFLAGS)

# Rules for Building Google Test and Google Mock (based on gmock's example).

# All Google Test headers. Usually you shouldn't change this definition.
Expand Down
Loading