Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
4357a5a
nix + docker work
katrinafyi Dec 4, 2024
d468595
move all docker things into script
katrinafyi Dec 4, 2024
a1882b8
add md5sum and docker hashing
katrinafyi Dec 4, 2024
4eda022
remove binaries in secret_write
katrinafyi Dec 4, 2024
dc5f18c
implement docker hashing
katrinafyi Dec 4, 2024
96f83ed
add hash files
katrinafyi Dec 4, 2024
6de43e5
check should depend on artefacts
katrinafyi Dec 4, 2024
59d965b
more things inside docker. use podman by default.
katrinafyi Dec 5, 2024
2084fc9
DELETE GENERATED FILES in src/test
katrinafyi Dec 5, 2024
a65f380
fix docker clang command and only md5sum certain files
katrinafyi Dec 5, 2024
83b6842
gitignore generated files
katrinafyi Dec 5, 2024
181ecb4
do not use -it in docker, to avoid CRLF
katrinafyi Dec 5, 2024
bec6d9f
add hash files in src/test
katrinafyi Dec 5, 2024
e096ee9
move docker commands into parent makefile
katrinafyi Dec 5, 2024
1a72342
fix running lift-directories.mk directly
katrinafyi Dec 5, 2024
9188366
add docker-flake
katrinafyi Dec 5, 2024
b3d1000
support 'env' inside docker-helper.sh
katrinafyi Dec 6, 2024
ec7ba8a
tweak and fix some things in hash generation
katrinafyi Dec 6, 2024
d9aa555
update hash with bap ite
katrinafyi Dec 6, 2024
f1c5475
tweaks to makefile
katrinafyi Dec 6, 2024
c65f7f6
add readme for docker usage
katrinafyi Dec 6, 2024
95b97e0
add bap-normalise and use original absolute paths in docker
katrinafyi Dec 9, 2024
dc10fad
update md5sums after bap-normalise
katrinafyi Dec 9, 2024
47e62b9
support nesting shell. fix bap-normalise. proto-json still broken
katrinafyi Dec 10, 2024
3df5ff7
split up targets to avoid inadvertent parallelism
katrinafyi Dec 10, 2024
48a65ca
add repro-check to readme
katrinafyi Dec 10, 2024
dd5e0d6
touch bap-normalise and make somewhat more atomic
katrinafyi Dec 10, 2024
69b56e1
update flake
katrinafyi Dec 10, 2024
265f432
fix bap normalise fr!
katrinafyi Dec 10, 2024
2cba5e3
hash changes after bap-normalise fix fr
katrinafyi Dec 10, 2024
3e844fa
support push/pull workflows in docker-helper
katrinafyi Dec 11, 2024
420c712
update flakes in docker-hash
katrinafyi Dec 11, 2024
5eff3b0
touch readme
katrinafyi Dec 11, 2024
6c430d7
big md5sums
katrinafyi Dec 11, 2024
2874d70
update md5sums after big md5sums
katrinafyi Dec 11, 2024
0092c63
update src/test with clearer steps and flow-chart
katrinafyi Dec 11, 2024
a57a12e
update development readme to mention Docker lifting
katrinafyi Dec 11, 2024
5ba93c4
update src/test/readme for new tests
katrinafyi Dec 11, 2024
419145e
remove files added from a docker shell
katrinafyi Dec 11, 2024
7af7677
update big md5sum
katrinafyi Dec 11, 2024
9dfe341
add gitattributes to mark generated files
katrinafyi Dec 11, 2024
bf4c9ed
remove suprious gcc1/gcc2
katrinafyi Dec 11, 2024
ecb3164
replace tabs in docker-helper
katrinafyi Dec 11, 2024
6ea272c
tarball extraction for compiled files
katrinafyi Dec 12, 2024
b5d37ca
ci: download and extract compiled files
katrinafyi Dec 12, 2024
f5230b2
makefile for everything in src/test and update readme
katrinafyi Dec 12, 2024
c78a06d
FIX missing arrays_simple
katrinafyi Dec 12, 2024
60cf168
use a docker-contents.txt instead of docker-hash everywhere
katrinafyi Dec 12, 2024
369473d
REMOVE GENERATED FILES in other directories
katrinafyi Dec 12, 2024
a080854
add md5sums for non-correct/incorret
katrinafyi Dec 12, 2024
7b1bdf9
add dsa/irred_loops, use tarbz2, add docker-contents
katrinafyi Dec 12, 2024
fd0e6d2
docker platform
katrinafyi Dec 12, 2024
3830d8b
avoid -v for macos
katrinafyi Dec 12, 2024
035658f
add macos notes, local notes, and dir mount notes
katrinafyi Dec 12, 2024
fb0a391
remove docker hash mentions
katrinafyi Dec 12, 2024
511558a
add sha1sum to compiled.url.txt
katrinafyi Dec 13, 2024
a45482f
Merge remote-tracking branch 'origin/main' into nix-docker-build
katrinafyi Dec 13, 2024
b0786ee
src/test/readme: fix markdown
katrinafyi Dec 13, 2024
113171f
UPDATE EXPECTED
katrinafyi Dec 13, 2024
2bf1d2e
extract set mtime to current time
katrinafyi Dec 13, 2024
e7b2fc3
allow file command to fail in Makefile
katrinafyi Dec 13, 2024
6cfd953
add new dsa examples
katrinafyi Dec 13, 2024
6c23bf0
handle empty directories and missing md5sum better
katrinafyi Dec 13, 2024
deaa46c
docker disable hardening
katrinafyi Dec 13, 2024
4eb193c
remove NIX_HARDENING from docker-helper
katrinafyi Dec 13, 2024
d19c174
gcc_pic: add -pie argument ?????
katrinafyi Dec 13, 2024
d9c9e2e
update binaries after -pie
katrinafyi Dec 13, 2024
d1612ad
sort big md5sum, use zst
katrinafyi Dec 13, 2024
dedc39b
update readme
katrinafyi Dec 13, 2024
fa740ff
support configuring LIFT_ARTEFACTS in config.mk and remove spurious B…
katrinafyi Dec 17, 2024
9073116
rename md5sum files to NAME.md5sum
katrinafyi Dec 17, 2024
33ba34c
remove dsa and irreducible_loop from the Makefile
katrinafyi Dec 17, 2024
306d0d8
exclude syscall/clang_O2:BAP
katrinafyi Dec 17, 2024
c040856
ci: run without docker, using pinned z3 and boogie
katrinafyi Dec 17, 2024
7a41b20
gitattibutes eol=lf for url and flake files
katrinafyi Dec 18, 2024
3a60c4c
docker-helper: push does not need platform
katrinafyi Dec 18, 2024
6bd37a2
document docker-helper variables, add DOCKER_TAG
katrinafyi Dec 18, 2024
d04b509
log url in make extract
katrinafyi Dec 18, 2024
9f38f73
lf for more files, use `stop` in docker-helper
katrinafyi Dec 18, 2024
5f3e137
add defaults for new tool variables
katrinafyi Dec 18, 2024
573af8f
choosing bap/gtirb based on existing files
katrinafyi Dec 18, 2024
ab1c744
update md5sums after bap/gtirb auto-detection
katrinafyi Dec 18, 2024
31b642f
-pie for gcc/gcc_O2 and update md5s
katrinafyi Dec 18, 2024
414de0c
preorder iterator
ailrst Dec 19, 2024
288b4e1
IndirectCallTests: auto-detect indirect call IDs
katrinafyi Dec 19, 2024
05e7deb
touch comment of ILForwardIterator
katrinafyi Dec 19, 2024
e9ad100
LiveVarsAnalysisTests: avoid fixed addresses
katrinafyi Jan 13, 2025
1dfbe3f
docker flake update. to pick up gtirb-semantics pc fix
katrinafyi May 15, 2025
0d4b7ee
Merge remote-tracking branch 'origin/main' into nix-docker-build
katrinafyi May 15, 2025
ae42e64
fix merge oopsie
katrinafyi May 15, 2025
85079be
update compiled tarball and add procedure_summaries
katrinafyi May 15, 2025
009dc88
ci: add 'make extract'
katrinafyi May 15, 2025
75947ab
make push TODO NOT DONE YET
katrinafyi May 15, 2025
c05d5ed
fix DataStructureAnalysisTest by avoiding unnecessary temps in memload
katrinafyi May 16, 2025
5b76273
remove bap from procedure_summary5 and update
katrinafyi May 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 15 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
md5sums linguist-generated
compiled.md5sum linguist-generated
docker-hash linguist-generated
*.gts linguist-generated
*.adt linguist-generated
*.bir linguist-generated
*.relf linguist-generated

src/test/compiled.url.txt text eol=lf
src/test/make/docker-flake.txt text eol=lf

Makefile text eol=lf
*.sh text eol=lf
*.mk text eol=lf
*.md5sum text eol=lf
9 changes: 8 additions & 1 deletion .github/workflows/run-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
- run: dotnet tool install --global boogie --version '3.4.3'

- run: ./mill compile
- run: make -C src/test extract
- run: ./mill test.test -oGD -T 1000000 -n test_util.tags.StandardSystemTest

- uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -130,6 +131,7 @@ jobs:
- run: dotnet tool install --global boogie --version '3.4.3'

- run: ./mill test.compile
- run: make -C src/test extract
- run: ./mill test.test -oGD -T 1000000 -n test_util.tags.UnitTest

UnitTests:
Expand All @@ -152,6 +154,7 @@ jobs:
- run: dotnet tool install --global boogie --version '3.4.3'

- run: ./mill test.compile
- run: make -C src/test extract
- run: ./mill test.test -oGD -T 1000000 -n test_util.tags.UnitTest

# every test with package prefix:
Expand All @@ -177,6 +180,7 @@ jobs:
- run: dotnet tool install --global boogie --version '3.4.3'

- run: ./mill test.compile
- run: make -C src/test extract
- run: ./mill test.test -oGD -T 1000000 -n test_util.tags.AnalysisSystemTest -F 2

AnalysisSystemTests2:
Expand All @@ -199,6 +203,7 @@ jobs:
- run: dotnet tool install --global boogie --version '3.4.3'

- run: ./mill test.compile
- run: make -C src/test extract
- run: ./mill test.test -oGD -T 1000000 -n test_util.tags.AnalysisSystemTest2 -F 2

AnalysisSystemTests3:
Expand All @@ -221,6 +226,7 @@ jobs:
- run: dotnet tool install --global boogie --version '3.4.3'

- run: ./mill test.compile
- run: make -C src/test extract
- run: ./mill test.test -oGD -T 1000000 -n test_util.tags.AnalysisSystemTest3 -F 2

AnalysisSystemTests4:
Expand All @@ -243,4 +249,5 @@ jobs:
- run: dotnet tool install --global boogie --version '3.4.3'

- run: ./mill test.compile
- run: ./mill test.test -oGD -T 1000000 -n test_util.tags.AnalysisSystemTest4 -F 2
- run: make -C src/test extract
- run: ./mill test.test -oGD -T 1000000 -n test_util.tags.AnalysisSystemTest4 -F 2
64 changes: 41 additions & 23 deletions docs/development/readme.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# BASIL Development

- [project-layout](project-layout.md) Organisation of the source code
- [editor-setup](editor-setup.md) Guide to basil development in IDEs
- [editor-setup](editor-setup.md) Guide to basil development in IDEs
- [tool-installation](tool-installation.md) Guide to lifter, etc. tool installation
- [scala](scala.md) Advice on Scala programming.
- [cfg](cfg.md) Explanation of the old CFG datastructure
- [cfg](cfg.md) Explanation of the old CFG datastructure
- [interpreter](interpreter.md) Explanation of IR interpreter
- [simplification-solvers](simplification-solvers.md) Explanation of simplification solvers

Expand All @@ -15,30 +15,30 @@ Basil is implemented in Scala 3.

See also: [Scala Gotchas](scala.md).

Scala is a mixed functional and object-oriented programming language implemented on the JVM. It is a very complicated
language with a lot of depth, so it is important to carefully chose the implementation complexity introduced.
Scala is a mixed functional and object-oriented programming language implemented on the JVM. It is a very complicated
language with a lot of depth, so it is important to carefully chose the implementation complexity introduced.

Generally, this means favouring simple standard solutions and choosing functional programming over stateful object oriented style
Generally, this means favouring simple standard solutions and choosing functional programming over stateful object oriented style
(use filter and map rather than loops), prefer immutable case classes and enums to regular mutable classes, etc.

ADTs and functions between ADTs are all you need to solve most problems. Most
things more complicated than this make the code unnecessarily difficult to maintain.
things more complicated than this make the code unnecessarily difficult to maintain.

It is recommended to explore the [Scala documentation](https://docs.scala-lang.org/scala3/book/introduction.html).
There is also the incomplete [Scala 3 language specification](https://github.com/scala/scala3/tree/main/docs/_spec),
There is also the incomplete [Scala 3 language specification](https://github.com/scala/scala3/tree/main/docs/_spec),
which contains details not present in the documentation, but is not completely updated from Scala 2.

Some general advice:

- Prefer [Enums](https://docs.scala-lang.org/scala3/book/types-adts-gadts.html) over inheritance trees
- Use functional programming over imperative wherever possible
- Prefer immutable case classes to regular classes wherever possible
- Don't unneccessarily use generics or type aliases
- Don't unneccessarily use generics or type aliases
- Correct code should not require explicit casts (`.asInstanceOf`)

#### Code style

We do not have a strict code style however
We do not have a strict code style however

- Use two spaces for indentation
- Use `{}` braces rather than purely indentation-based scoping
Expand All @@ -49,17 +49,17 @@ We do not have a strict code style however
1. To set up an editor for Scala development see [editor-setup](editor-setup.md).
2. Become familiar with the [project structure](project-layout.md) to start understanding the code.
3. Install the neccessary tools [here](tool-installation.md), it may be useful to try
lifting examples, or just looking at existing examples in the
lifting examples, or just looking at existing examples in the
[src/test/correct](../../src/test/correct) directory.
4. Use the below as a guide to common development tasks as they may arise.
4. Use the below as a guide to common development tasks as they may arise.

## Development tasks

Mill should always be run from the git root directory (`git rev-parse --show-toplevel`).

## Building

To build the project you can use `./mill build`. Often the incremental compilation database won't be properly invalidated on
To build the project you can use `./mill build`. Often the incremental compilation database won't be properly invalidated on
`git switch`/`git checkout`/`git pull`: in these cases `./mill clean` is needed to trigger a full rebuild.

To build a standalone `.jar` file, use `./mill assembly`. This can be found at `out/assembly.dest/out.jar`.
Expand All @@ -71,7 +71,7 @@ Printing an analysis result
Run basil with the `--analysis-result <filepath>` flag to print the results of the analyses to files.
The `--analysis-result-dot <filepath>` does the same, but outputs a graphviz digraph, which can be viewed by pasting it into [edotor.net](edotor.net), or compiling with `dot`.

This prints the program with the abstract-domain lattice value at each program point following the `::`.
This prints the program with the abstract-domain lattice value at each program point following the `::`.

```
Procedure main
Expand All @@ -84,14 +84,27 @@ Procedure main
To achieve this for a new result in development use the following method defined in `RunUtils.scala`

```scala
def printAnalysisResults(prog: Program, result: Map[CFGPosition, _]): String
def printAnalysisResults(prog: Program, result: Map[CFGPosition, _]): String
```


## Code Formatting

All Pull Requests must conform to the style produced by `scalafmt`. This is checked automatically in CI, it can be run locally with:

<<<<<<< HEAD
The [dsl](../basil-ir.md#constructing-programs-in-code) can be used to construct simple example BASIL IR programs, which can then be fed through into the whole pipeline via `IRLoading.load()` in
`RunUtils.scala`. Prefer to write tests that depend only on the single piece of code under test rather than the whole BASIL translation.

### Integration tests

These are the `SystemTests.scala` test case with the files present in `src/test/correct` for examples that should verify and `src/test/incorrect`
for examples that should not verify.

These are run via the Makefiles in src/test.
A Docker image is used to compile and lift examples in a reproducible way.
See [src/test/readme.md](../src/test/readme.md) for details.
=======
```bash
./mill scalafmt.checkFormat
```
Expand All @@ -105,24 +118,29 @@ Sources can be reformatted with:

## Tests

The tests are defined as C source files and must be compiled before use.
Before running any tests, download the pre-compiled test case files with:
```bash
$ make -C src/test extract
```

### Running Tests

See [testing](testing.md).
For information about running tests, see [testing](testing.md).

For more details on the process of compiling C test cases, including adding and editing test cases,
see [src/test/readme.md](../src/test/readme.md).

## Performance profiling

While the first priority is correctness, the performance target for the static
analyses is that we can run through the entire
[cntlm](https://github.com/versat/cntlm) binary in a reasonable amount of time
(seconds), depending on the expected performance of the analysis involved.
While the first priority is correctness, the performance target for the static
analyses is that we can run through the entire
[cntlm](https://github.com/versat/cntlm) binary in a reasonable amount of time
(seconds), depending on the expected performance of the analysis involved.
Loading cntlm requires increasing the heap size by providing the `-Xmx8G` flag.

IntelliJ professional (which can be obtained for free by students) includes a performance profiler.

Alternatively, [async-profiler](https://github.com/async-profiler/async-profiler) can be used to produce a
[flame graph](https://brendangregg.com/flamegraphs.html) showing the hot-spots in the program. Download the library from
Alternatively, [async-profiler](https://github.com/async-profiler/async-profiler) can be used to produce a
[flame graph](https://brendangregg.com/flamegraphs.html) showing the hot-spots in the program. Download the library from
the [releases tab](https://github.com/async-profiler/async-profiler/releases), compile a basil .jar with `mill assembly` and run the jar with the following arguments.

Instructions for Linux and Mac:
Expand Down
20 changes: 14 additions & 6 deletions docs/development/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@ Both of these will be output in yellow text if your console is using colour.

## Running Individual suites

From git root directory run `mill test.testOnly`, tests suite names are glob matched against its argument,
Before running any tests, download the pre-compiled test case files with:
```bash
$ make -C src/test extract
```

From git root directory run `mill test.testOnly`, tests suite names are glob matched against its argument,
for example to run all the SystemTest variants use:

```
Expand All @@ -164,19 +169,22 @@ $ ./mill test.testOnly 'SystemTests*'

### Compiling the Integration test binaries

These are checked in to the respository, but can be recompiled (and new tests compiled) with the following instructions:

These are the `SystemTests.scala` test case with the files present in `src/test/correct` for examples that should verify and `src/test/incorrect`
for examples that should not verify.
for examples that should not verify.

The tests are defined as C source files and must be compiled and lifted before use.
These are lifted via the Makefiles, to add another test simply add a directory, c source file, and optionally specification file and run

These are lifted via the Makefiles, to add another test simply add a directory, c source file, and optionally specification file and run
Compilation is done in a Docker container environment for consistency.
A tarball of pre-compiled files is provided to get started quickly.

```sh
cd src/test/
make extract
make
```

The `config.mk` file in the test directory can be used to exclude unnecessary compilers, and change compilation flags.
The `config.mk` file in the test directory can be used to exclude unnecessary compilers, and change compilation flags.
Full details can be found [here](../src/test/readme.md).


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ class Graph(using Counter)(
}

def SSAVar(posLabel: String, varName: String): Slice = {
assert(posLabel.matches("%[0-9a-f]{8}?\\$\\d"), s"posLabel not matching BAP format '$posLabel'")
assert(posLabel.matches("""%[0-9a-f]{8}?(:\$\d)?"""), s"posLabel not matching BAP format '$posLabel'")

val res = varToCell.keys.filter(pos => pos.toShortString.startsWith(posLabel))
assert(res.size == 1, s"failed to get SSAVar for '$posLabel' and '$varName'. matched label: ${res}")
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/ir/IRCursor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ir.cilvisitor.*
import collection.mutable
import scala.annotation.tailrec

/**
/**
* This file defines functions to get the successor and predecessor of a IR node for control flow.
*/

Expand Down
10 changes: 6 additions & 4 deletions src/main/scala/translating/BAPToIR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,12 @@ class BAPToIR(var program: BAPProgram, mainAddress: BigInt) {
val lhs = translateVar(b.lhs)
val (rhs, load) = translateExpr(b.rhs)
if (load.isDefined) {
val loadWithLabel =
MemoryLoad(load.get.lhs, load.get.mem, load.get.index, load.get.endian, load.get.size, Some(b.line + "$0"))
val assign = LocalAssign(lhs, rhs, Some(b.line + "$1"))
Seq(loadWithLabel, assign)
if rhs != load.get.lhs then {
Seq(MemoryLoad(load.get.lhs, load.get.mem, load.get.index, load.get.endian, load.get.size, Some(b.line + "$0")),
LocalAssign(lhs, rhs, Some(b.line + "$1")))
} else {
Seq(MemoryLoad(lhs, load.get.mem, load.get.index, load.get.endian, load.get.size, Some(b.line + "$0")))
}
} else {
val assign = LocalAssign(lhs, rhs, Some(b.line))
Seq(assign)
Expand Down
15 changes: 14 additions & 1 deletion src/test/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,17 @@
*.csv
*.md
*.md.part
*.svg
*.svg

# files reproducibly generated
*.relf
*.adt
*.bir
*.gtirb
*.gts
docker-hash-new
!compiled.url.txt
*.gz
*.bz2
*.xz
*.zst
64 changes: 56 additions & 8 deletions src/test/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,60 @@
TARGETSS := all verify clean cleanall cleanlift recompile json cleanjson cleangts gts
TARGETSS := all verify repro-stash repro-check md5sum-check md5sum-update clean cleanall cleanlift recompile json cleanjson cleangts gts

SUBTARGETS = $(wildcard correct/*/ incorrect/*/)
.PHONY : $(TARGETSS) $(SUBTARGETS) correct incorrect
# subdirectories of src/test. to be entered into by this makefile.
DIRS := correct incorrect extraspec_correct extraspec_incorrect indirect_calls memory_regions procedure_summaries
# dirs with different directory structure: dsa, irreducible_loops

$(TARGETSS): $(SUBTARGETS)
# non-test dirs: make, scala, unimplemented

correct: $(realpath $(wildcard correct/*))
incorrect: $(realpath $(wildcard incorrect/*))
# in case the user specfies DIRS, make sure all dirs exist.
$(foreach d, $(DIRS), \
$(if $(wildcard $(d)/.), \
, \
$(error user error: directory "$(d)" in DIRS variable does not exist)))

SUBDIRS = $(wildcard $(addsuffix /*/,$(DIRS)))
.PHONY : $(TARGETSS) $(SUBDIRS) $(DIRS)

# through some unpleasantness, this lets the user specify either DIRS or SUBDIRS
# on the command line, and the make operation will be narrowed to that directory
$(TARGETSS): $(SUBDIRS)

$(SUBDIRS):
$(MAKE) -C $@ -f $(realpath ./make/lift-directories.mk) $(MAKECMDGOALS)

# concats md5sums files in subdirectories into a compiled.md5sum.
# check with `md5sum -c compiled.md5sum` in src/test.
.PHONY: compiled.md5sum
compiled.md5sum:
find $(DIRS) -name '*.md5sum' -exec cat '{}' + | sort -k2 > compiled.md5sum

TARBALL := compiled.tar.zst

$(TARBALL) docker-contents.txt &: compiled.md5sum
set -u; $$DOCKER_CMD hash > docker-contents.txt # before compessing, make sure docker-contents.txt is up to date.
md5sum --quiet -c compiled.md5sum # before compressing, make sure our files match expected hashes.
list=`mktemp`; cut -d' ' -f3 compiled.md5sum > $$list && tar caf $(TARBALL) -T $$list && rm $$list
sha1sum $(TARBALL)

.PHONY: extract
extract:
# log URL and expected hash
{ head -n1 compiled.url.txt; tail -n1 compiled.url.txt; } | cat -v
# check existing file, otherwise download fresh copy.
{ tail -n1 compiled.url.txt | sha1sum -c - ; } \
|| curl "$$(head -n1 compiled.url.txt)" -o $(TARBALL)
Comment thread
l-kent marked this conversation as resolved.
# check file type.
-file $(TARBALL)
# validate the hash, otherwise remove the incorrect file and abort.
{ tail -n1 compiled.url.txt | sha1sum -c - ; } || { rm -v $(TARBALL); exit 1; }
tar xf $(TARBALL) --keep-old-files --touch
md5sum --quiet -c compiled.md5sum # check that extracted files match expected checksums

.PHONY: push
push:
tmp=`mktemp -d` && \
git clone git@github.com:UQ-PAC/basil-tests.git $$tmp --single-branch --branch basil-src-test && \
cd $$tmp && \

rm -rf $$tmp

$(SUBTARGETS):
-$(MAKE) -C $@ -f $(realpath ./make/lift-directories.mk) $(MAKECMDGOALS)
Loading
Loading