Skip to content

Commit 33e1070

Browse files
authored
test macos 15 too (#405)
* test macos 15 too * ditch update * os * Fix matrix key from 'operating-system' to 'os' * try octal printf * more macos fixes * operating-system -> os * last operating system -> os * remove error indent
1 parent 0070202 commit 33e1070

6 files changed

Lines changed: 66 additions & 42 deletions

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ permissions: {}
1212

1313
jobs:
1414
build-and-test-native:
15-
runs-on: ${{ matrix.operating-system }}
15+
runs-on: ${{ matrix.os }}
1616
strategy:
1717
matrix:
18-
operating-system: [ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm]
18+
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm, macos-15]
1919
steps:
2020
- uses: actions/checkout@v4
2121

@@ -26,6 +26,8 @@ jobs:
2626
run: |
2727
if [[ "${{ runner.os }}-${{ runner.arch }}" == "Linux-ARM64" ]]; then
2828
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_arm64-latest.tar.gz
29+
elif [[ "${{ runner.os }}" == "macOS" ]]; then
30+
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-latest.tar.gz
2931
else
3032
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
3133
fi
@@ -43,42 +45,50 @@ jobs:
4345

4446
- run: ./roc_nightly/roc version
4547

46-
- run: |
47-
sudo apt update
48-
sudo apt install -y expect ncat valgrind ripgrep
49-
# expect for testing
50-
# ncat for tcp-client example
51-
# ripgrep for ci/check_all_exposed_funs_tested.roc
48+
- name: Install dependencies (Ubuntu)
49+
if: startsWith(matrix.os, 'ubuntu-')
50+
run: |
51+
sudo apt install -y expect ncat ripgrep
52+
53+
- name: Install dependencies (macOS)
54+
if: startsWith(matrix.os, 'macos-')
55+
run: |
56+
brew install expect # expect for testing
57+
brew install nmap # includes ncat, for tcp-client example
58+
brew install ripgrep # ripgrep for ci/check_all_exposed_funs_tested.roc
5259
5360
- run: expect -v
5461

5562
- name: Run all tests
5663
run: ROC=./roc_nightly/roc EXAMPLES_DIR=./examples/ ./ci/all_tests.sh
5764

5865
- name: Install dependencies for musl build
66+
if: startsWith(matrix.os, 'ubuntu-')
5967
run: |
6068
sudo apt-get install -y musl-tools
61-
if [[ "${{ matrix.operating-system }}" == *"-arm" ]]; then
69+
if [[ "${{ matrix.os }}" == *"-arm" ]]; then
6270
# TODO re-enable once TODO below is done: rustup target add aarch64-unknown-linux-musl
6371
echo "no-op"
6472
else
6573
rustup target add x86_64-unknown-linux-musl
6674
fi
6775
6876
- name: Test building with musl target
77+
if: startsWith(matrix.os, 'ubuntu-')
6978
env:
7079
ROC: ./roc_nightly/roc
7180
run: |
72-
if [[ "${{ matrix.operating-system }}" == *"-arm" ]]; then
81+
if [[ "${{ matrix.os}}" == *"-arm" ]]; then
7382
# TODO debug this: CARGO_BUILD_TARGET=aarch64-unknown-linux-musl $ROC build.roc
7483
echo "no-op"
7584
else
7685
CARGO_BUILD_TARGET=x86_64-unknown-linux-musl $ROC build.roc
7786
fi
7887
7988
- name: Test using musl build
89+
if: startsWith(matrix.os, 'ubuntu-')
8090
run: |
8191
# TODO remove `if` when above TODOs are done
82-
if [[ "${{ matrix.operating-system }}" != *"-arm" ]]; then
92+
if [[ "${{ matrix.os }}" != *"-arm" ]]; then
8393
NO_BUILD=1 IS_MUSL=1 ROC=./roc_nightly/roc EXAMPLES_DIR=./examples/ ./ci/all_tests.sh
8494
fi

ci/expect_scripts/path-test.exp

100644100755
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ test_parent/test_child/test_grandchild
4545
Number of directories created: 3
4646
Directory contents:
4747
total \\d+
48-
dr\[-rwx\]+ +\\d+ \\w+ (\\w+ )? *\\d+ \\w+ +\\d+ \\d+:\\d+ \\.
49-
dr\[-rwx\]+ +\\d+ \\w+ (\\w+ )? *\\d+ \\w+ +\\d+ \\d+:\\d+ \\.\\.
50-
-\[-rwx\]+ +\\d+ \\w+ (\\w+ )? *\\d+ \\w+ +\\d+ \\d+:\\d+ file1\\.txt
51-
-\[-rwx\]+ +\\d+ \\w+ (\\w+ )? *\\d+ \\w+ +\\d+ \\d+:\\d+ file2\\.txt
52-
dr\[-rwx\]+ +\\d+ \\w+ (\\w+ )? *\\d+ \\w+ +\\d+ \\d+:\\d+ subdir
48+
d.* \\.
49+
d.* \\.\\.
50+
-.* file1\\.txt
51+
-.* file2\\.txt
52+
d.* subdir
5353

5454
Empty dir was deleted: Bool.true
55-
Size before delete_all: \\d+\\w*\\s*test_parent
55+
Size before delete_all:\\s*\\d+\\w*\\s*test_parent
5656

5757
Parent dir no longer exists: Bool.true
5858

@@ -63,8 +63,8 @@ Original content: Original content for Path hard link test
6363
Link content: Original content for Path hard link test
6464
Content matches: Bool.true
6565
Inode information:
66-
\\d+ -rw-r--r-- \\d+ \\w+ (\\w+ )? *\\d+ \\w+ +\\d+ \\d+:\\d+ test_path_hardlink\\.txt
67-
\\d+ -rw-r--r-- \\d+ \\w+ (\\w+ )? *\\d+ \\w+ +\\d+ \\d+:\\d+ test_path_original\\.txt
66+
\\d+ .* test_path_hardlink\\.txt
67+
\\d+ .* test_path_original\\.txt
6868

6969
First file inode: \\\[\"\\d+\"\\\]
7070
Second file inode: \\\[\"\\d+\"\\\]
@@ -83,19 +83,19 @@ I ran all Path function tests.
8383

8484
Cleaning up test files...
8585
Files to clean up:
86-
-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_bytes\\.txt
87-
-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_hardlink\\.txt
88-
-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_json\\.json
89-
-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_original\\.txt
90-
-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_rename_new\\.txt
91-
-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_utf8\\.txt
92-
93-
ls: cannot access .*
94-
ls: cannot access .*
95-
ls: cannot access .*
96-
ls: cannot access .*
97-
ls: cannot access .*
98-
ls: cannot access .*
86+
-.* test_path_bytes\\.txt
87+
-.* test_path_hardlink\\.txt
88+
-.* test_path_json\\.json
89+
-.* test_path_original\\.txt
90+
-.* test_path_rename_new\\.txt
91+
-.* test_path_utf8\\.txt
92+
93+
ls: .*
94+
ls: .*
95+
ls: .*
96+
ls: .*
97+
ls: .*
98+
ls: .*
9999
Files deleted successfully: Bool.true
100100
"]
101101

platform/main.roc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ main_for_host! = |raw_args|
6161
6262
Program exited with error:
6363
64-
❌ ${clean_err_str}
64+
❌ ${clean_err_str}
6565
"""
6666

6767
_ = Stderr.line!(help_msg)

tests/cmd-test.roc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ main! = |_args|
5151
# Test StdoutContainsInvalidUtf8 - using printf to output invalid UTF-8 bytes
5252
expect_err(
5353
Cmd.new("printf")
54-
|> Cmd.args(["%b", "\\xff\\xfe"]) # Invalid UTF-8 sequence
54+
|> Cmd.args(["\\377\\376"]) # Invalid UTF-8 sequence
5555
|> Cmd.exec_output!,
56-
"(Err (StdoutContainsInvalidUtf8 {cmd_str: \"{ cmd: printf, args: %b \\xff\\xfe }\", err: (BadUtf8 {index: 0, problem: InvalidStartByte})}))"
56+
"(Err (StdoutContainsInvalidUtf8 {cmd_str: \"{ cmd: printf, args: \\377\\376 }\", err: (BadUtf8 {index: 0, problem: InvalidStartByte})}))"
5757
)?
5858

5959
# exec_output_bytes!

tests/file.roc

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ main! = |_args|
1616
Ok(_) ->
1717
cleanup_test_files!(FilesNeedToExist)
1818
Err(err) ->
19-
cleanup_test_files!(FilesMaybeExist)?
19+
_ = cleanup_test_files!(FilesMaybeExist)
2020
Err(Exit(1, "Test run failed:\n\t${Inspect.to_str(err)}"))
2121

2222
run_tests! : {} => Result {} _

tests/path-test.roc

100644100755
Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ main! = |_args|
1616
Ok(_) ->
1717
cleanup_test_files!(FilesNeedToExist)
1818
Err(err) ->
19-
cleanup_test_files!(FilesMaybeExist)?
19+
_ = cleanup_test_files!(FilesMaybeExist)
2020
Err(Exit(1, "Test run failed:\n\t${Inspect.to_str(err)}"))
2121

2222
run_tests!: {} => Result {} _
@@ -247,6 +247,21 @@ test_directory_operations! = |{}|
247247
248248
Ok({})
249249
250+
get_hard_link_count! : Str => Result Str _
251+
get_hard_link_count! = |path_str|
252+
ls_l =
253+
Cmd.new("ls")
254+
|> Cmd.args(["-l", path_str])
255+
|> Cmd.exec_output!()?
256+
257+
hard_link_count_str =
258+
(ls_l.stdout_utf8
259+
|> Str.split_on(" ")
260+
|> List.keep_if(|str| !Str.is_empty(str))
261+
|> List.get(1)) ? |_| IExpectedALineWithASpaceHere(ls_l)
262+
263+
Ok(hard_link_count_str)
264+
250265
test_hard_link! : {} => Result {} _
251266
test_hard_link! = |{}|
252267
Stdout.line!("\nTesting Path.hard_link!:")?
@@ -255,24 +270,23 @@ test_hard_link! = |{}|
255270
original_path = Path.from_str("test_path_original.txt")
256271
Path.write_utf8!("Original content for Path hard link test", original_path)?
257272
258-
# Get original file stats
259-
stat_before = Cmd.new("stat") |> Cmd.args(["-c", "%h", "test_path_original.txt"]) |> Cmd.exec_output!()?
273+
hard_link_count_before = get_hard_link_count!("test_path_original.txt")?
260274
261275
# Create hard link
262276
link_path = Path.from_str("test_path_hardlink.txt")
263277
when Path.hard_link!(original_path, link_path) is
264278
Ok({}) ->
265279
# Get link count after
266-
stat_after = Cmd.new("stat") |> Cmd.args(["-c", "%h", "test_path_original.txt"]) |> Cmd.exec_output!()?
280+
hard_link_count_after = get_hard_link_count!("test_path_original.txt")?
267281
268282
# Verify both files exist and have same content
269283
original_content = Path.read_utf8!(original_path)?
270284
link_content = Path.read_utf8!(link_path)?
271285
272286
Stdout.line!(
273287
"""
274-
Hard link count before: ${Str.trim(stat_before.stdout_utf8)}
275-
Hard link count after: ${Str.trim(stat_after.stdout_utf8)}
288+
Hard link count before: ${hard_link_count_before}
289+
Hard link count after: ${hard_link_count_after}
276290
Original content: ${original_content}
277291
Link content: ${link_content}
278292
Content matches: ${Inspect.to_str(original_content == link_content)}

0 commit comments

Comments
 (0)