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

Add test.sh and related GHA check #2

Merged
merged 5 commits into from
Apr 19, 2024
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
6 changes: 6 additions & 0 deletions .github/workflows/build-and-test.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ local job = {
./bootstrap-mk.sh
|||,
},
{
name: 'Basic test',
run: |||
./test.sh
|||,
},
],
};

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
run: |
eval $(opam env)
./bootstrap-mk.sh
- name: Basic test
run: |
./test.sh
name: build-and-test
on:
pull_request: null
Expand Down
21 changes: 13 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
# -*- sh -*-
# ocaml objects
# Generated binaries
bin/*

# OCaml objects
*.cm*
*.annot

# OCaml binaries
*.byte
*.opt

# c objects
# C objects
*.o
*.a

# syncweb objects
# Syncweb objects
#TODO: uncomment at some point, but make sure 'make sync'
# is working in principia for lex/ yacc/ lib_parsing/ and version_control/
#.md5sum_*

# kencc objects
# Kencc objects
*.[58]

# ??
*.output

# make generated files
# Make generated files
.depend

# parsers
# Parsers
/assembler/lexer_asm5.ml
/assembler/parser_asm5.ml
/assembler/parser_asm5.mli
Expand Down Expand Up @@ -51,6 +56,7 @@
/macroprocessor/lexer_cpp.ml

# binaries
# TODO: move to bin/ so no need all of this
/assembler/5a
/linker/5l
/compiler/5c
Expand Down Expand Up @@ -78,4 +84,3 @@
/lib_gui/tests/hellogui

# ????

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
###############################################################################

all:
@echo use ./bootstrap-mk.sh and then BOOTSTRAP/mk instead of make
@echo use ./bootstrap-mk.sh and then ./bin/mk instead of make

clean:
git clean -fX
Expand Down
Empty file added bin/.keep
Empty file.
28 changes: 19 additions & 9 deletions bootstrap-mk.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
#!/bin/sh

# this file was mostly auto-generated by copy-pasting a trace of mk
# Script to compile 'mk' (and 'rc') without using 'mk' (nor 'rc') and generate
# a bin/mk (and bin/rc) so that we don't need a BOOTSTRAP/Linux/386/bin/mk
# like in kencc. Note that kencc has no BOOTSTRAP/Linux/386/bin/rc because
# it assumes the presence of a shell and can work both with 'rc' and 'sh'.
#
# Note that right now to boostrap Xix we still need:
# - OCaml (which itself requires to bootstrap ocamllex, ocamlyacc and C)
# - a C compiler
# - /bin/sh
#
# Maybe at some point the assembler/linker/compiler in this repo will
# be able to bootstrap itself and we will just need an ocamlrun bytecode
# version of those tools in BOOTSTRAP/.
#
# This file was mostly auto-generated by copy-pasting a trace of mk.

# any error should abort the script
set -e

# for showing the executed commands (verbose)
set -x

#-bin-annot -absname -dtypes -g
#TODO? -bin-annot -absname -dtypes -g
OCAMLCFLAGS=

# for windows under cygwin
#TODO: seems necessary also on linux, otherwise runtime error about missing dllcamlstr
#-custom
#TODO? for windows under cygwin might need -custom
EXTRALINKFLAGS=

TOP=`pwd`
Expand Down Expand Up @@ -116,5 +126,5 @@ ocamlc.opt $OCAMLCFLAGS -I ../lib_core/commons -I ../lib_core/collections -c int
ocamlc.opt -g $EXTRALINKFLAGS -I ../lib_core/commons -I ../lib_core/collections str.cma unix.cma ../lib_core/collections/lib.cma ../lib_core/commons/lib.cma flags.cmo globals.cmo ast.cmo meta_ast.cmo opcode.cmo meta_opcode.cmo dumper.cmo compile.cmo runtime.cmo pattern.cmo fn.cmo var.cmo prompt.cmo status.cmo path.cmo process.cmo error.cmo parser.cmo lexer.cmo parse.cmo builtin.cmo op_repl.cmo op_process.cmo interpreter.cmo main.cmo ../lib_core/collections/lib.cma ../lib_core/commons/lib.cma -o rc

cd $TOP
cp mk/mk shell/rc BOOTSTRAP/
echo 'Copy BOOTSTRAP/mk somewhere in your PATH and sets MKSHELL to point to rc.'
cp mk/mk shell/rc bin/
echo 'Copy bin/mk bin/rc somewhere in your PATH and sets MKSHELL to point to rc.'
16 changes: 16 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
# Basic testing.
#
# This script assume you ran first ./bootstrap-mk.sh before.
#
# LATER: ideally later we could switch to rc instead of sh

# any error should abort the script
set -e
# for showing the executed commands (verbose)
set -x

# Just make sure at least the programs are not segfaulting
# or dynamic linking errors
./bin/mk --help
./bin/rc --help
Loading