Skip to content

Commit

Permalink
tests/deps: Test of typical dependencies example
Browse files Browse the repository at this point in the history
  • Loading branch information
obiwac committed Dec 21, 2024
1 parent fba12d9 commit 9a102db
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

. tests/common.sh

# Test Bob dependencies.
# TODO Check that we're caching dependencies correctly (i.e. same version same cache, different versions different cache).

# Test of regular usage of dependencies.

cp tests/deps/build.normal.fl tests/deps/build.fl
rm -rf tests/deps/.bob tests/deps/dep1/.bob tests/deps/dep2/.bob

out=$(bob -C tests/deps run dep2 2>&1)

if [ $? != 0 ]; then
echo "Failed to run binary pre-installed by dependency: $out" >&2
exit 1
fi
6 changes: 6 additions & 0 deletions tests/deps/dep2/build.fl
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
# Copyright (c) 2024 Aymeric Wibo

import bob

install = {
Linker([]).link(Cc([]).compile(["main.c"])): "bin/dep2",
}

run = ["dep2"]
10 changes: 10 additions & 0 deletions tests/deps/dep2/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2024 Aymeric Wibo

#include <stdio.h>
#include <stdlib.h>

int main(void) {
printf("Hello, world!\n");
return EXIT_SUCCESS;
}

0 comments on commit 9a102db

Please sign in to comment.