Skip to content

Commit fbc5bb4

Browse files
committed
wire up makefile to run codegen tests and add one to start
1 parent e14cd39 commit fbc5bb4

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,7 @@ do
731731
make_dir $h/test/perf
732732
make_dir $h/test/pretty
733733
make_dir $h/test/debug-info
734+
make_dir $h/test/codegen
734735
make_dir $h/test/doc-tutorial
735736
make_dir $h/test/doc-tutorial-ffi
736737
make_dir $h/test/doc-tutorial-macros

mk/tests.mk

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ check-stage$(1)-T-$(2)-H-$(3)-exec: \
246246
check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
247247
check-stage$(1)-T-$(2)-H-$(3)-bench-exec \
248248
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-exec \
249+
check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
249250
check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
250251
check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
251252

@@ -430,6 +431,8 @@ CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
430431
BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
431432
PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
432433
DEBUGINFO_RS := $(wildcard $(S)src/test/debug-info/*.rs)
434+
CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
435+
CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)
433436

434437
# perf tests are the same as bench tests only they run under
435438
# a performance monitor.
@@ -443,6 +446,7 @@ BENCH_TESTS := $(BENCH_RS)
443446
PERF_TESTS := $(PERF_RS)
444447
PRETTY_TESTS := $(PRETTY_RS)
445448
DEBUGINFO_TESTS := $(DEBUGINFO_RS)
449+
CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)
446450

447451
CTEST_SRC_BASE_rpass = run-pass
448452
CTEST_BUILD_BASE_rpass = run-pass
@@ -479,10 +483,19 @@ CTEST_BUILD_BASE_debuginfo = debug-info
479483
CTEST_MODE_debuginfo = debug-info
480484
CTEST_RUNTOOL_debuginfo = $(CTEST_RUNTOOL)
481485

486+
CTEST_SRC_BASE_codegen = codegen
487+
CTEST_BUILD_BASE_codegen = codegen
488+
CTEST_MODE_codegen = codegen
489+
CTEST_RUNTOOL_codegen = $(CTEST_RUNTOOL)
490+
482491
ifeq ($(CFG_GDB),)
483492
CTEST_DISABLE_debuginfo = "no gdb found"
484493
endif
485494

495+
ifeq ($(CFG_CLANG),)
496+
CTEST_DISABLE_codegen = "no clang found"
497+
endif
498+
486499
ifeq ($(CFG_OSTYPE),apple-darwin)
487500
CTEST_DISABLE_debuginfo = "gdb on darwing needs root"
488501
endif
@@ -507,6 +520,8 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
507520
--compile-lib-path $$(HLIB$(1)_H_$(3)) \
508521
--run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
509522
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
523+
--clang-path $(if $(CFG_CLANG),$(CFG_CLANG),clang) \
524+
--llvm-bin-path $(CFG_LLVM_INST_DIR_$(CFG_BUILD_TRIPLE))/bin \
510525
--aux-base $$(S)src/test/auxiliary/ \
511526
--stage-id stage$(1)-$(2) \
512527
--target $(2) \
@@ -522,6 +537,7 @@ CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
522537
CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS)
523538
CTEST_DEPS_perf_$(1)-T-$(2)-H-$(3) = $$(PERF_TESTS)
524539
CTEST_DEPS_debuginfo_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_TESTS)
540+
CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
525541

526542
endef
527543

@@ -565,7 +581,7 @@ endif
565581

566582
endef
567583

568-
CTEST_NAMES = rpass rpass-full rfail cfail bench perf debuginfo
584+
CTEST_NAMES = rpass rpass-full rfail cfail bench perf debuginfo codegen
569585

570586
$(foreach host,$(CFG_HOST_TRIPLES), \
571587
$(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
@@ -674,6 +690,7 @@ TEST_GROUPS = \
674690
bench \
675691
perf \
676692
debuginfo \
693+
codegen \
677694
doc \
678695
$(foreach docname,$(DOC_TEST_NAMES),doc-$(docname)) \
679696
pretty \

src/test/codegen/hello.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <stddef.h>
2+
3+
struct slice {
4+
char const *p;
5+
size_t len;
6+
};
7+
8+
extern "C"
9+
void test() {
10+
struct slice s = { .p = "hello",
11+
.len = 5 };
12+
}

src/test/codegen/hello.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#[no_mangle]
2+
fn test() {
3+
let _x = "hello";
4+
}

0 commit comments

Comments
 (0)