Skip to content

Commit

Permalink
Configure sml/nj tests and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-byrne committed Sep 20, 2024
1 parent 836da73 commit abf2935
Show file tree
Hide file tree
Showing 8 changed files with 204 additions and 341 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/run-sml-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run SMLUnit Unit Tests
name: Run SML/NJ Custom Tests

on:
push:
Expand All @@ -19,16 +19,9 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install smlnj # Install SML/NJ
sudo apt-get install smlsharp # Install SML#
sudo apt-get install llvm-14 # Install LLVM 14
sudo apt-get install libmyth # Install mythril
# Add the path to the libmyth.so file to the LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
# Create a symbolic link to the libmyth.so file
sudo ln -s /usr/lib/x86_64-linux-gnu/libmyth.so.0 /usr/lib/x86_64-linux-gnu/libmyth.so
- name: Run SML tests
run: |
chmod +x test
./test
./test false
33 changes: 33 additions & 0 deletions .github/workflows/run-smlsharp-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Run SMLUnit Unit Tests with SML#

on:
push:
branches:
- master
- dev
pull_request:

jobs:
test:
runs-on: ubuntu-latest

if: contains(github.event.head_commit.message, '[smlsharp-test]')

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install SML#
run: |
sudo apt-get update
sudo apt-get install smlnj # Install SML/NJ
sudo apt-get install smlsharp # Install SML#
sudo apt-get install llvm-14 # Install LLVM 14
sudo apt-get install libmyth # Install mythril
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
sudo ln -s /usr/lib/x86_64-linux-gnu/libmyth.so.0 /usr/lib/x86_64-linux-gnu/libmyth.so
- name: Run SML tests
run: |
chmod +x test
./test true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
tests/**/skip*.sm*

**repo-link.txt
links.md
**/*temp.md
Expand Down
2 changes: 1 addition & 1 deletion src/ica05/ica5.sml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fun reverseList([]) = []
| reverseList(li) = reverseList(tl(li)) @ [hd(li)];

fun removeZeros([]) = []
| removeZeros(li) =
| removeZeros(li) =
if hd(li) = 0 then removeZeros(tl(li))
else hd(li) :: removeZeros(tl(li));

Expand Down
124 changes: 0 additions & 124 deletions src/ica05/ica6.sml

This file was deleted.

21 changes: 18 additions & 3 deletions test
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/bin/bash

#sudo find / -name "libmyth.*"
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
#
# Args:
# $1: Use SMLUnit (true/false)
#

USE_SMLUNIT=${1:-false}

# Define the path to the tests folder
TESTS_DIR="./tests"
Expand All @@ -18,5 +22,16 @@ fi
# Load each test file in the SML interpreter
for TEST_FILE in $TEST_FILES; do
echo "Running tests in: $TEST_FILE"
smlsharp < "$TEST_FILE"

# If we are using SMLUnit, load the SMLUnit library before loading the test file
if [ "$USE_SMLUNIT" = true ]; then
echo "Using SMLUnit"
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
# smlsharp < "$TESTS_DIR/SMLUnit/smlunit-lib.smi"
smlsharp < "$TEST_FILE"

# Else, just use sml to load the test file
else
sml < "$TEST_FILE"
fi
done
99 changes: 0 additions & 99 deletions tests/temp.sml

This file was deleted.

Loading

0 comments on commit abf2935

Please sign in to comment.