From 7eb28a1dafbee1af0aa7868aec9b17375bcb2861 Mon Sep 17 00:00:00 2001 From: pad Date: Fri, 19 Apr 2024 11:43:00 +0200 Subject: [PATCH 1/5] Add test.sh and related GHA check test plan: ./bootstrap-mk.sh ./test.sh and wait for green CI Checks --- .github/workflows/build-and-test.jsonnet | 6 ++++++ .github/workflows/build-and-test.yml | 3 +++ .gitignore | 21 +++++++++++++-------- bin/.keep | 0 bootstrap-mk.sh | 19 ++++++++++--------- test.sh | 13 +++++++++++++ 6 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 bin/.keep create mode 100755 test.sh diff --git a/.github/workflows/build-and-test.jsonnet b/.github/workflows/build-and-test.jsonnet index d579d9b3..78f3f7d0 100644 --- a/.github/workflows/build-and-test.jsonnet +++ b/.github/workflows/build-and-test.jsonnet @@ -48,6 +48,12 @@ local job = { ./bootstrap-mk.sh |||, }, + { + name: 'Basic test', + run: ||| + ./test.sh + |||, + }, ], }; diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 475d6df3..6733dfe1 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -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 diff --git a/.gitignore b/.gitignore index 1aaf59d8..8fcf02f1 100644 --- a/.gitignore +++ b/.gitignore @@ -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 @@ -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 @@ -78,4 +84,3 @@ /lib_gui/tests/hellogui # ???? - diff --git a/bin/.keep b/bin/.keep new file mode 100644 index 00000000..e69de29b diff --git a/bootstrap-mk.sh b/bootstrap-mk.sh index 86e98f43..eaca721a 100755 --- a/bootstrap-mk.sh +++ b/bootstrap-mk.sh @@ -1,19 +1,20 @@ #!/bin/sh - -# this file was mostly auto-generated by copy-pasting a trace of mk +# Script to compile 'mk' without using 'mk' to generate a bin/mk +# so that we don't need a BOOTSTRAP/mk. +# Note that right now to boostrap xix we still need OCaml and a C +# compiler as well as sh. +# +# 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` @@ -116,5 +117,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.' diff --git a/test.sh b/test.sh new file mode 100755 index 00000000..4df2896e --- /dev/null +++ b/test.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Basic testing +# 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 + +./BOOTSTRAP/mk --help +./BOOTSTRAP/rc --help From dd92bc067675ed295e42ebcf0fe12c5834d823d2 Mon Sep 17 00:00:00 2001 From: pad Date: Fri, 19 Apr 2024 11:45:24 +0200 Subject: [PATCH 2/5] comment --- test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test.sh b/test.sh index 4df2896e..9152a8b7 100755 --- a/test.sh +++ b/test.sh @@ -8,6 +8,7 @@ set -e set -x # Just make sure at least the programs are not segfaulting +# or dynamic linking errors ./BOOTSTRAP/mk --help ./BOOTSTRAP/rc --help From beb366c5595535021eace97d1030ec2ca6f4266a Mon Sep 17 00:00:00 2001 From: pad Date: Fri, 19 Apr 2024 11:49:21 +0200 Subject: [PATCH 3/5] fix --- test.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test.sh b/test.sh index 9152a8b7..8b62a4b2 100755 --- a/test.sh +++ b/test.sh @@ -1,5 +1,8 @@ #!/bin/sh -# Basic testing +# 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 @@ -9,6 +12,5 @@ set -x # Just make sure at least the programs are not segfaulting # or dynamic linking errors - -./BOOTSTRAP/mk --help -./BOOTSTRAP/rc --help +./bin/mk --help +./bin/rc --help From f29953849e89626a235dcc94917ed02148e52201 Mon Sep 17 00:00:00 2001 From: pad Date: Fri, 19 Apr 2024 11:59:14 +0200 Subject: [PATCH 4/5] comment --- Makefile | 2 +- bootstrap-mk.sh | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 16015f25..c7d8d62b 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/bootstrap-mk.sh b/bootstrap-mk.sh index eaca721a..0c9cc12c 100755 --- a/bootstrap-mk.sh +++ b/bootstrap-mk.sh @@ -1,8 +1,11 @@ #!/bin/sh -# Script to compile 'mk' without using 'mk' to generate a bin/mk -# so that we don't need a BOOTSTRAP/mk. -# Note that right now to boostrap xix we still need OCaml and a C -# compiler as well as sh. +# Script to compile 'mk' (without using 'mk') and generate a bin/mk +# so that we don't need a BOOTSTRAP/Linux/386/bin/mk like in kencc. +# +# 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 # # This file was mostly auto-generated by copy-pasting a trace of mk. From 36432d4432bf0664b7d10a70cb98c0f0018ea49a Mon Sep 17 00:00:00 2001 From: pad Date: Fri, 19 Apr 2024 12:06:09 +0200 Subject: [PATCH 5/5] more comments --- bootstrap-mk.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bootstrap-mk.sh b/bootstrap-mk.sh index 0c9cc12c..bd7874c4 100755 --- a/bootstrap-mk.sh +++ b/bootstrap-mk.sh @@ -1,12 +1,18 @@ #!/bin/sh -# Script to compile 'mk' (without using 'mk') and generate a bin/mk -# so that we don't need a BOOTSTRAP/Linux/386/bin/mk like in kencc. +# 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