Skip to content

Commit 356f09c

Browse files
authored
test: add integration tests (#285)
1 parent 80f7771 commit 356f09c

11 files changed

Lines changed: 345 additions & 0 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,6 @@ cython_debug/
141141
# static files generated from Django application using `collectstatic`
142142
media
143143
static
144+
145+
test/fixtures/out
146+
*.actual
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
2+
cmake_policy(VERSION 2.8.8)
3+
project(test)
4+
set(configuration "Default")
5+
enable_language(ASM)
6+
set(builddir "${CMAKE_CURRENT_BINARY_DIR}")
7+
set(obj "${builddir}/obj")
8+
9+
set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)
10+
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
11+
12+
13+
14+
#*/gyp-next/test/fixtures/integration.gyp:test#target
15+
set(TARGET "test")
16+
set(TOOLSET "target")
17+
set(test__cxx_srcs "../../test.cc")
18+
link_directories( ../../mylib
19+
)
20+
add_executable(test ${test__cxx_srcs})
21+
set_target_properties(test PROPERTIES EXCLUDE_FROM_ALL "FALSE")
22+
set_target_properties(test PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${builddir}")
23+
set_target_properties(test PROPERTIES PREFIX "")
24+
set_target_properties(test PROPERTIES RUNTIME_OUTPUT_NAME "test")
25+
set_target_properties(test PROPERTIES SUFFIX "")
26+
set_source_files_properties(${builddir}/test PROPERTIES GENERATED "TRUE")
27+
set(test__include_dirs "${CMAKE_CURRENT_LIST_DIR}/../../include")
28+
set_property(TARGET test APPEND PROPERTY INCLUDE_DIRECTORIES ${test__include_dirs})
29+
set_target_properties(test PROPERTIES COMPILE_FLAGS "-fasm-blocks -mpascal-strings -Os -gdwarf-2 -arch x86_64 ")
30+
unset(TOOLSET)
31+
unset(TARGET)
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# This file is generated by gyp; do not edit.
2+
3+
TOOLSET := target
4+
TARGET := test
5+
DEFS_Default :=
6+
7+
# Flags passed to all source files.
8+
CFLAGS_Default := \
9+
-fasm-blocks \
10+
-mpascal-strings \
11+
-Os \
12+
-gdwarf-2 \
13+
-arch \
14+
x86_64
15+
16+
# Flags passed to only C files.
17+
CFLAGS_C_Default :=
18+
19+
# Flags passed to only C++ files.
20+
CFLAGS_CC_Default :=
21+
22+
# Flags passed to only ObjC files.
23+
CFLAGS_OBJC_Default :=
24+
25+
# Flags passed to only ObjC++ files.
26+
CFLAGS_OBJCC_Default :=
27+
28+
INCS_Default := \
29+
-I$(srcdir)/include
30+
31+
OBJS := \
32+
$(obj).target/$(TARGET)/test.o
33+
34+
# Add to the list of files we specially track dependencies for.
35+
all_deps += $(OBJS)
36+
37+
# CFLAGS et al overrides must be target-local.
38+
# See "Target-specific Variable Values" in the GNU Make manual.
39+
$(OBJS): TOOLSET := $(TOOLSET)
40+
$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
41+
$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
42+
$(OBJS): GYP_OBJCFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE))
43+
$(OBJS): GYP_OBJCXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE))
44+
45+
# Suffix rules, putting all outputs into $(obj).
46+
47+
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
48+
@$(call do_cmd,cxx,1)
49+
50+
# Try building from generated source, too.
51+
52+
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
53+
@$(call do_cmd,cxx,1)
54+
55+
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
56+
@$(call do_cmd,cxx,1)
57+
58+
# End of this set of suffix rules
59+
### Rules for final target.
60+
LDFLAGS_Default := \
61+
-arch \
62+
x86_64 \
63+
-L$(builddir) \
64+
-Lmylib
65+
66+
LIBTOOLFLAGS_Default :=
67+
68+
LIBS :=
69+
70+
$(builddir)/test: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
71+
$(builddir)/test: LIBS := $(LIBS)
72+
$(builddir)/test: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE))
73+
$(builddir)/test: LD_INPUTS := $(OBJS)
74+
$(builddir)/test: TOOLSET := $(TOOLSET)
75+
$(builddir)/test: $(OBJS) FORCE_DO_CMD
76+
$(call do_cmd,link)
77+
78+
all_deps += $(builddir)/test
79+
# Add target alias
80+
.PHONY: test
81+
test: $(builddir)/test
82+
83+
# Add executable to "all" target.
84+
.PHONY: all
85+
all: $(builddir)/test
86+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
defines =
2+
includes = -I../../include
3+
cflags = -fasm-blocks -mpascal-strings -Os -gdwarf-2 -arch x86_64
4+
cflags_c =
5+
cflags_cc =
6+
cflags_objc = $cflags_c
7+
cflags_objcc = $cflags_cc
8+
arflags =
9+
10+
build obj/test.test.o: cxx ../../test.cc
11+
12+
ldflags = -arch x86_64 -L./
13+
libs = -L../../mylib
14+
build test: link obj/test.test.o
15+
ld = $ldxx
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
2+
cmake_policy(VERSION 2.8.8)
3+
project(test)
4+
set(configuration "Default")
5+
enable_language(ASM)
6+
set(builddir "${CMAKE_CURRENT_BINARY_DIR}")
7+
set(obj "${builddir}/obj")
8+
9+
set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)
10+
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
11+
12+
set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1)
13+
14+
15+
#*/test/fixtures/integration.gyp:test#target
16+
set(TARGET "test")
17+
set(TOOLSET "target")
18+
set(test__cxx_srcs "../../test.cc")
19+
link_directories( ../../mylib
20+
)
21+
add_executable(test ${test__cxx_srcs})
22+
set_target_properties(test PROPERTIES EXCLUDE_FROM_ALL "FALSE")
23+
set_target_properties(test PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${builddir}")
24+
set_target_properties(test PROPERTIES PREFIX "")
25+
set_target_properties(test PROPERTIES RUNTIME_OUTPUT_NAME "test")
26+
set_target_properties(test PROPERTIES SUFFIX "")
27+
set_source_files_properties(${builddir}/test PROPERTIES GENERATED "TRUE")
28+
set(test__include_dirs "${CMAKE_CURRENT_LIST_DIR}/../../include")
29+
set_property(TARGET test APPEND PROPERTY INCLUDE_DIRECTORIES ${test__include_dirs})
30+
set_target_properties(test PROPERTIES COMPILE_FLAGS "")
31+
unset(TOOLSET)
32+
unset(TARGET)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# This file is generated by gyp; do not edit.
2+
3+
TOOLSET := target
4+
TARGET := test
5+
DEFS_Default :=
6+
7+
# Flags passed to all source files.
8+
CFLAGS_Default :=
9+
10+
# Flags passed to only C files.
11+
CFLAGS_C_Default :=
12+
13+
# Flags passed to only C++ files.
14+
CFLAGS_CC_Default :=
15+
16+
INCS_Default := \
17+
-I$(srcdir)/include
18+
19+
OBJS := \
20+
$(obj).target/$(TARGET)/test.o
21+
22+
# Add to the list of files we specially track dependencies for.
23+
all_deps += $(OBJS)
24+
25+
# CFLAGS et al overrides must be target-local.
26+
# See "Target-specific Variable Values" in the GNU Make manual.
27+
$(OBJS): TOOLSET := $(TOOLSET)
28+
$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
29+
$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
30+
31+
# Suffix rules, putting all outputs into $(obj).
32+
33+
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
34+
@$(call do_cmd,cxx,1)
35+
36+
# Try building from generated source, too.
37+
38+
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
39+
@$(call do_cmd,cxx,1)
40+
41+
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
42+
@$(call do_cmd,cxx,1)
43+
44+
# End of this set of suffix rules
45+
### Rules for final target.
46+
LDFLAGS_Default := \
47+
-Lmylib
48+
49+
LIBS :=
50+
51+
$(builddir)/test: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
52+
$(builddir)/test: LIBS := $(LIBS)
53+
$(builddir)/test: LD_INPUTS := $(OBJS)
54+
$(builddir)/test: TOOLSET := $(TOOLSET)
55+
$(builddir)/test: $(OBJS) FORCE_DO_CMD
56+
$(call do_cmd,link)
57+
58+
all_deps += $(builddir)/test
59+
# Add target alias
60+
.PHONY: test
61+
test: $(builddir)/test
62+
63+
# Add executable to "all" target.
64+
.PHONY: all
65+
all: $(builddir)/test
66+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
defines =
2+
includes = -I../../include
3+
cflags =
4+
cflags_c =
5+
cflags_cc =
6+
arflags =
7+
8+
build obj/test.test.o: cxx ../../test.cc
9+
10+
ldflags =
11+
libs = -L../../mylib
12+
build test: link obj/test.test.o
13+
ld = $ldxx

test/fixtures/include/test.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
int foo();

test/fixtures/integration.gyp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
'targets': [
3+
{
4+
'target_name': 'test',
5+
'type': 'executable',
6+
'sources': [
7+
'test.cc',
8+
],
9+
'include_dirs': [
10+
'include',
11+
],
12+
'library_dirs': [
13+
'mylib'
14+
],
15+
},
16+
]
17+
}

test/fixtures/test.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "test.h"
2+
3+
int main() {
4+
return foo();
5+
}
6+
7+
int foo() {
8+
return 0;
9+
}

0 commit comments

Comments
 (0)