Skip to content

Commit fd0404d

Browse files
committed
More Makefile fixes (test dependencies, test-rewatch)
1 parent 78a98ca commit fd0404d

File tree

8 files changed

+39
-37
lines changed

8 files changed

+39
-37
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ jobs:
363363
shell: bash
364364

365365
- name: Run rewatch tests
366-
run: ./rewatch/tests/suite.sh
366+
run: ./rewatch/tests/suite.sh rewatch/target/release/rescript
367367
shell: bash
368368

369369
- name: Run syntax benchmarks
@@ -671,7 +671,7 @@ jobs:
671671
working-directory: rewatch/testrepo
672672

673673
- name: Run rewatch integration tests
674-
run: ./rewatch/tests/suite.sh node_modules/.bin/rescript
674+
run: ./rewatch/tests/suite.sh rewatch/testrepo/node_modules/.bin/rescript
675675
shell: bash
676676

677677
publish:

Makefile

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,35 +148,37 @@ clean-lib:
148148
yarn workspace @rescript/runtime rescript clean
149149
rm -f $(RUNTIME_BUILD_STAMP)
150150

151-
# Tests / artifacts / analysis
151+
# Artifact list
152152

153153
artifacts: lib
154154
./scripts/updateArtifactList.js
155155

156-
bench: $(COMPILER_BUILD_STAMP)
156+
# Tests
157+
158+
bench: compiler
157159
$(DUNE_BIN_DIR)/syntax_benchmarks
158160

159-
test: lib ninja | $(YARN_INSTALL_STAMP)
161+
test: lib ninja
160162
node scripts/test.js -all
161163

162-
test-analysis: | $(YARN_INSTALL_STAMP)
164+
test-analysis: lib ninja
163165
make -C tests/analysis_tests clean test
164166

165-
test-tools: | $(YARN_INSTALL_STAMP)
167+
test-tools: lib ninja
166168
make -C tests/tools_tests clean test
167169

168-
test-syntax: | $(YARN_INSTALL_STAMP)
170+
test-syntax: compiler
169171
./scripts/test_syntax.sh
170172

171-
test-syntax-roundtrip: | $(YARN_INSTALL_STAMP)
173+
test-syntax-roundtrip: compiler
172174
ROUNDTRIP_TEST=1 ./scripts/test_syntax.sh
173175

174-
test-gentype: | $(YARN_INSTALL_STAMP)
176+
test-gentype: lib ninja
175177
make -C tests/gentype_tests/typescript-react-example clean test
176178
make -C tests/gentype_tests/stdlib-no-shims clean test
177179

178-
test-rewatch: $(RESCRIPT_EXE) | $(YARN_INSTALL_STAMP)
179-
./rewatch/tests/suite.sh
180+
test-rewatch: lib
181+
./rewatch/tests/suite.sh $(RESCRIPT_EXE)
180182

181183
test-all: test test-gentype test-analysis test-tools test-rewatch
182184

rewatch/tests/clean.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ else
1717
fi
1818

1919
# Then we clean a single project
20-
error_output=$(cd packages/file-casing && "../../$REWATCH_EXECUTABLE" clean 2>&1)
20+
error_output=$(cd packages/file-casing && "$REWATCH_EXECUTABLE" clean 2>&1)
2121
clean_status=$?
2222
if [ $clean_status -ne 0 ];
2323
then
@@ -86,7 +86,7 @@ fi
8686
bold "Test: It should clean dependencies from node_modules"
8787

8888
# Build a package with external dependencies
89-
error_output=$(cd packages/with-dev-deps && "../../$REWATCH_EXECUTABLE" build 2>&1)
89+
error_output=$(cd packages/with-dev-deps && "$REWATCH_EXECUTABLE" build 2>&1)
9090
if [ $? -eq 0 ];
9191
then
9292
success "Built with-dev-deps"
@@ -97,7 +97,7 @@ else
9797
fi
9898

9999
# Then we clean a single project
100-
error_output=$(cd packages/with-dev-deps && "../../$REWATCH_EXECUTABLE" clean 2>&1)
100+
error_output=$(cd packages/with-dev-deps && "$REWATCH_EXECUTABLE" clean 2>&1)
101101
clean_status=$?
102102
if [ $clean_status -ne 0 ];
103103
then

rewatch/tests/compile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fi
3737
# Build from standalone package folder using `rescript build`
3838
bold "Test: Standalone package can build via rescript from package folder"
3939
pushd ./packages/standalone > /dev/null
40-
error_output=$("../../$REWATCH_EXECUTABLE" build 2>&1)
40+
error_output=$("$REWATCH_EXECUTABLE" build 2>&1)
4141
if [ $? -eq 0 ];
4242
then
4343
success "Standalone package built"

rewatch/tests/compiler-args.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ cd ../testrepo
66
bold "Test: It should not matter where we grab the compiler-args for a file"
77
# Capture stdout for both invocations
88
stdout_root=$(rewatch compiler-args packages/file-casing/src/Consume.res 2>/dev/null)
9-
stdout_pkg=$(cd packages/file-casing && "../../$REWATCH_EXECUTABLE" compiler-args src/Consume.res 2>/dev/null)
9+
stdout_pkg=$(cd packages/file-casing && "$REWATCH_EXECUTABLE" compiler-args src/Consume.res 2>/dev/null)
1010

1111
error_output=$(rewatch compiler-args packages/file-casing/src/Consume.res 2>&1)
1212
if [ $? -ne 0 ]; then
1313
error "Error grabbing compiler args for packages/file-casing/src/Consume.res"
1414
printf "%s\n" "$error_output" >&2
1515
exit 1
1616
fi
17-
error_output=$(cd packages/file-casing && "../../$REWATCH_EXECUTABLE" compiler-args src/Consume.res 2>&1)
17+
error_output=$(cd packages/file-casing && "$REWATCH_EXECUTABLE" compiler-args src/Consume.res 2>&1)
1818
if [ $? -ne 0 ]; then
1919
error "Error grabbing compiler args for src/Consume.res in packages/file-casing"
2020
printf "%s\n" "$error_output" >&2

rewatch/tests/format.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fi
4545

4646
bold "Test: It should format only the current project"
4747

48-
error_output=$(cd packages/file-casing && "../../$REWATCH_EXECUTABLE" format)
48+
error_output=$(cd packages/file-casing && "$REWATCH_EXECUTABLE" format)
4949
git_diff_file_count=$(git diff --name-only ./ | wc -l | xargs)
5050
if [ $? -eq 0 ] && [ $git_diff_file_count -eq 2 ];
5151
then

rewatch/tests/get_bin_paths.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
// @ts-check
22
import { bsc_exe } from "../../cli/common/bins.js";
3-
import path from "node:path";
4-
5-
const runtimePath = path.resolve(
6-
import.meta.dirname,
7-
"..",
8-
"..",
9-
"packages",
10-
"@rescript",
11-
"runtime"
12-
);
3+
import { runtimePath } from "../../cli/common/runtime.js";
134

145
console.log(`RESCRIPT_BSC_EXE='${bsc_exe}'`);
156
console.log(`RESCRIPT_RUNTIME='${runtimePath}'`);

rewatch/tests/suite.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
11
#!/bin/bash
22

3+
set -e
4+
35
unset CLICOLOR_FORCE
46

7+
if [ "$#" -ne 1 ]; then
8+
echo "Usage: $0 <rewatch executable>"
9+
exit 1
10+
fi
11+
12+
REWATCH_EXECUTABLE="$(realpath "$1")"
13+
export REWATCH_EXECUTABLE
14+
515
# Make sure we are in the right directory
616
cd $(dirname $0)
717

8-
# Get rewatch executable location from the first argument or use default
9-
if [ -n "$1" ]; then
10-
REWATCH_EXECUTABLE="$1"
18+
if [[ "$REWATCH_EXECUTABLE" == */cli/rescript.js ]]; then
19+
echo "Using rewatch CLI script: $REWATCH_EXECUTABLE"
1120
else
12-
REWATCH_EXECUTABLE="../target/release/rescript"
21+
echo "Using rewatch executable: $REWATCH_EXECUTABLE"
1322
eval $(node ./get_bin_paths.js)
23+
export RESCRIPT_BSC_EXE
24+
export RESCRIPT_RUNTIME
25+
echo Using bsc executable: $RESCRIPT_BSC_EXE
26+
echo Using runtime path: $RESCRIPT_RUNTIME
1427
fi
1528

16-
export REWATCH_EXECUTABLE
17-
export RESCRIPT_BSC_EXE
18-
export RESCRIPT_RUNTIME
19-
2029
source ./utils.sh
2130

2231
bold "Yarn install"

0 commit comments

Comments
 (0)