Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move specs for arithmetic primitives to primitives_spec #11298

Merged
merged 18 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 14 additions & 14 deletions .github/workflows/aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ jobs:
with:
args: make crystal
- name: Upload Crystal executable
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v2
with:
name: crystal-aarch64-musl
path: .build/crystal
path: |
.build/crystal
src/llvm/ext/llvm_ext.o
musl-test-stdlib:
needs: musl-build
runs-on: [linux, ARM64]
Expand All @@ -26,10 +28,9 @@ jobs:
- name: Download Crystal source
uses: actions/checkout@v2
- name: Download Crystal executable
uses: actions/download-artifact@v1
uses: actions/download-artifact@v2
with:
name: crystal-aarch64-musl
path: .build/
- name: Mark downloaded compiler as executable
run: chmod +x .build/crystal
- name: Run stdlib specs
Expand All @@ -44,16 +45,15 @@ jobs:
- name: Download Crystal source
uses: actions/checkout@v2
- name: Download Crystal executable
uses: actions/download-artifact@v1
uses: actions/download-artifact@v2
with:
name: crystal-aarch64-musl
path: .build/
- name: Mark downloaded compiler as executable
run: chmod +x .build/crystal
- name: Run compiler specs
uses: docker://jhass/crystal:1.0.0-alpine-build
with:
args: make compiler_spec
args: make primitives_spec compiler_spec
gnu-build:
runs-on: [linux, ARM64]
if: github.repository == 'crystal-lang/crystal'
Expand All @@ -65,10 +65,12 @@ jobs:
with:
args: make crystal
- name: Upload Crystal executable
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v2
with:
name: crystal-aarch64-gnu
path: .build/crystal
path: |
.build/crystal
src/llvm/ext/llvm_ext.o
gnu-test-stdlib:
needs: gnu-build
runs-on: [linux, ARM64]
Expand All @@ -77,10 +79,9 @@ jobs:
- name: Download Crystal source
uses: actions/checkout@v2
- name: Download Crystal executable
uses: actions/download-artifact@v1
uses: actions/download-artifact@v2
with:
name: crystal-aarch64-gnu
path: .build/
- name: Mark downloaded compiler as executable
run: chmod +x .build/crystal
- name: Run stdlib specs
Expand All @@ -95,13 +96,12 @@ jobs:
- name: Download Crystal source
uses: actions/checkout@v2
- name: Download Crystal executable
uses: actions/download-artifact@v1
uses: actions/download-artifact@v2
with:
name: crystal-aarch64-gnu
path: .build/
- name: Mark downloaded compiler as executable
run: chmod +x .build/crystal
- name: Run compiler specs
uses: docker://jhass/crystal:1.0.0-build
with:
args: make compiler_spec
args: make primitives_spec compiler_spec
11 changes: 9 additions & 2 deletions .github/workflows/win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ jobs:

- name: Build stdlib specs executable
run: |
bin\crystal.exe build spec/std_spec.cr --exclude-warnings spec/std --exclude-warnings spec/compiler -Di_know_what_im_doing
bin\crystal.exe build spec/std_spec.cr --exclude-warnings spec/std -Di_know_what_im_doing
- name: Run socket specs
run: |
.\std_spec.exe --verbose -e TCPSocket
Expand All @@ -292,7 +292,14 @@ jobs:

- name: Build compiler specs executable
run: |
bin\crystal.exe build spec/compiler_spec.cr --exclude-warnings spec/std --exclude-warnings spec/compiler -Dwithout_playground -Di_know_what_im_doing
bin\crystal.exe build spec/compiler_spec.cr --exclude-warnings spec/compiler -Dwithout_playground -Di_know_what_im_doing
- name: Run compiler specs
run: |
.\compiler_spec.exe

- name: Build primitives specs executable
run: |
bin\crystal.exe build spec/primitives_spec.cr --exclude-warnings spec/primitives -Dwithout_playground -Di_know_what_im_doing
- name: Run primitives specs
run: |
.\primitives_spec.exe
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Executing `make crystal` builds the compiler into `.build/compiler` and you can
The script sets up the proper environment variables that the compiler can find the standard library source files in `src/`.

`make compiler_spec` runs the compiler specs. `make std_spec` runs the standard library specs.
`make primitives_spec` runs the specs for primitive methods with an up-to-date Crystal compiler.
You can use `make help` for a list of available make targets.

## This guide
Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ O := .build
SOURCES := $(shell find src -name '*.cr')
SPEC_SOURCES := $(shell find spec -name '*.cr')
override FLAGS += $(if $(release),--release )$(if $(stats),--stats )$(if $(progress),--progress )$(if $(threads),--threads $(threads) )$(if $(debug),-d )$(if $(static),--static )$(if $(LDFLAGS),--link-flags="$(LDFLAGS)" )$(if $(target),--cross-compile --target $(target) )
SPEC_WARNINGS_OFF := --exclude-warnings spec/std --exclude-warnings spec/compiler
SPEC_WARNINGS_OFF := --exclude-warnings spec/std --exclude-warnings spec/compiler --exclude-warnings spec/primitives
SPEC_FLAGS := $(if $(verbose),-v )$(if $(junit_output),--junit_output $(junit_output) )
CRYSTAL_CONFIG_LIBRARY_PATH := '$$ORIGIN/../lib/crystal'
CRYSTAL_CONFIG_BUILD_COMMIT := $(shell git rev-parse --short HEAD 2> /dev/null)
Expand Down Expand Up @@ -99,6 +99,10 @@ std_spec: $(O)/std_spec ## Run standard library specs
compiler_spec: $(O)/compiler_spec ## Run compiler specs
$(O)/compiler_spec $(SPEC_FLAGS)

.PHONY: primitives_spec
primitives_spec: $(O)/primitives_spec ## Run primitives specs
$(O)/primitives_spec $(SPEC_FLAGS)

.PHONY: smoke_test ## Build specs as a smoke test
smoke_test: $(O)/std_spec $(O)/compiler_spec $(O)/crystal

Expand Down Expand Up @@ -167,6 +171,10 @@ $(O)/compiler_spec: $(DEPS) $(SOURCES) $(SPEC_SOURCES)
@mkdir -p $(O)
$(EXPORT_CC) $(EXPORTS) ./bin/crystal build $(FLAGS) $(SPEC_WARNINGS_OFF) -o $@ spec/compiler_spec.cr

$(O)/primitives_spec: $(O)/crystal $(DEPS) $(SOURCES) $(SPEC_SOURCES)
@mkdir -p $(O)
$(EXPORT_CC) ./bin/crystal build $(FLAGS) $(SPEC_WARNINGS_OFF) -o $@ spec/primitives_spec.cr

$(O)/crystal: $(DEPS) $(SOURCES)
@mkdir -p $(O)
$(EXPORTS) $(EXPORTS_BUILD) ./bin/crystal build $(FLAGS) -o $@ src/compiler/crystal.cr -D without_openssl -D without_zlib
Expand Down
8 changes: 6 additions & 2 deletions bin/check-compiler-flag
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
# This script will
# * run the compiler_spec using the flag
# * build the compiler to have the flag available (in case the flag is introduced in this version)
# * run the std_spec with and without the flag
# * run the std_spec and primitives_spec with and without the flag
# * check the compiler_spec built with and without the flag (eg: the specs build with the flag can generate a compiler without the flag)
# * build a 2nd generation of the compiler using the flag
# * repeat the checks for the std_spec and compiler_spec with and without the flag
# * repeat the checks for the spec suites with and without the flag

set -eux

Expand All @@ -27,6 +27,8 @@ md5 .build/crystal
# run specs
make clean_cache std_spec
make clean_cache std_spec FLAGS="-D$COMPILER_FLAG"
make clean_cache primitives_spec
make clean_cache primitives_spec FLAGS="-D$COMPILER_FLAG"

# test compiler_specs
make clean_cache
Expand All @@ -47,6 +49,8 @@ md5 .build/crystal
# run specs
make clean_cache std_spec
make clean_cache std_spec FLAGS="-D$COMPILER_FLAG"
make clean_cache primitives_spec
make clean_cache primitives_spec FLAGS="-D$COMPILER_FLAG"

# run compiler specs
make clean_cache
Expand Down
3 changes: 2 additions & 1 deletion bin/ci
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ build() {
i=$((i + 1))
done

with_build_env 'make primitives_spec threads=1 junit_output=.junit/primitives_spec.xml'
with_build_env 'make docs threads=1'
;;
*)
with_build_env 'make crystal std_spec compiler_spec docs threads=1 junit_output=.junit/spec.xml DOCS_OPTIONS="--json-config-url=/api/versions.json --canonical-base-url=https://crystal-lang.org/api/latest/"'
with_build_env 'make crystal primitives_spec std_spec compiler_spec docs threads=1 junit_output=.junit/spec.xml DOCS_OPTIONS="--json-config-url=/api/versions.json --canonical-base-url=https://crystal-lang.org/api/latest/"'
;;
esac

Expand Down
1 change: 1 addition & 0 deletions spec/all_spec.cr
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require "spec"
require "./compiler/**"
require "./std_spec"
require "./primitives_spec"
Loading