-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[swift] Infrastructure for frontend tests
Summary: Setting up the framework for frontend tests for Swift Reviewed By: ngorogiannis Differential Revision: D68568005 fbshipit-source-id: f37ff00b045b6d13d0fd108bd038eb44bebe1675
- Loading branch information
1 parent
7355d12
commit 5c9d100
Showing
11 changed files
with
81 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ _build_infer | |
*.exp.test* | ||
*.dot.test | ||
*.test.dot | ||
*.test.sil | ||
*.test.txt | ||
duplicates.txt | ||
*.ast.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Array.sil, line 36, column 6: textual type error: expression n4 has type *int[][], while a subtype of *(*int[])[] was expected | ||
Array.sil, line 35, column 6: textual type error: expression n4 has type *int[][], while a subtype of *(*int[])[] was expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
TESTS_DIR=../../.. | ||
|
||
SWIFT_OPTIONS = | ||
INFER_OPTIONS = | ||
|
||
SOURCES = $(wildcard *.swift) | ||
|
||
CLEAN_EXTRA = $(foreach source,$(SOURCES),$(basename $(notdir $(source))).o) | ||
|
||
include $(TESTS_DIR)/base.make | ||
include $(TESTS_DIR)/swift-base.make | ||
|
||
default: test | ||
|
||
%.test.sil: %.swift $(SWIFT_DEPS) $(HEADERS) | ||
$(QUIET)$(call silent_on_success,Testing the infer/swift frontend in $(TEST_REL_DIR),\ | ||
$(INFER_BIN) capture --frontend-tests --dump-textual --project-root $(TESTS_DIR) $(INFER_OPTIONS) -- \ | ||
$(SWIFTC) $(SWIFT_OPTIONS) $<) | ||
|
||
capture: $(SOURCES:.swift=.test.sil) | ||
|
||
.PHONY: print | ||
print: capture | ||
|
||
.PHONY: test | ||
test: capture | ||
$(QUIET)error=0; for file in $(SOURCES) ; do \ | ||
diff -u "$$file.sil" "$$file.test.sil" || error=1 ; \ | ||
done ; \ | ||
if [ $$error = 1 ]; then exit 1; fi | ||
|
||
.PHONY: replace | ||
replace: capture | ||
$(QUIET)for file in $(SOURCES) ; do \ | ||
mv $$file.test.sil $$file.sil ; \ | ||
done | ||
|
||
.PHONY: clean | ||
clean: | ||
$(REMOVE_DIR) infer-out */*.test.sil */*/*.test.sil $(CLEAN_EXTRA) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
func main() { | ||
print("Hello, World!") | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// | ||
// Copyright (c) Facebook, Inc. and its affiliates. | ||
// | ||
// This source code is licensed under the MIT license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
%.o: %.swift | ||
$(SWIFTC) $(SWIFT_OPTIONS) -o $@ $< |