Skip to content

linuxci: test compiling linux #5

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

Open
wants to merge 34 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2928600
Adds regression tests that involve non-recursive function calls
Mar 10, 2021
3f2d21e
Fixes PR number
Mar 10, 2021
1b13a25
Adds regression tests that involve recursive function calls
Mar 10, 2021
08660bf
Adds regression tests that involve alternate recursive function calls
Mar 10, 2021
7166cd5
Applies clang-format to the addedfiles
Mar 11, 2021
01444b7
Assesses PR comments and adds handling for loop unwinding
Mar 11, 2021
879afa2
Enable cpp-from-CVS regression tests
tautschnig Mar 15, 2021
c1d5a1c
clang-format recently moved tests
tautschnig Mar 17, 2021
3175b5c
Merge pull request #5935 from tautschnig/cpp-regression-test
tautschnig Mar 18, 2021
f9f33dc
Increase version number to 5.26.0
thomasspriggs Mar 18, 2021
2c7d136
Merge pull request #5953 from thomasspriggs/tas/release_5_26_0
thomasspriggs Mar 18, 2021
c5cc454
Merge pull request #5911 from ArenBabikian/contracts-recursion-reg-tests
feliperodri Mar 18, 2021
502040f
Properly rename regression tests from cbmc-cpp
feliperodri Mar 18, 2021
29a323f
Merge pull request #5954 from feliperodri/fix-cpp-regression
feliperodri Mar 18, 2021
5f1b66a
Add cbmc --incremental regression tests as FUTURE
tautschnig Mar 18, 2021
64a7ca9
symtab2gb should populate configt
tautschnig Mar 19, 2021
e3aabfa
diff_to_added_lines: report all errors on stderr
tautschnig Mar 15, 2021
585b359
cpplint strictly requires Python 2
tautschnig Mar 15, 2021
ccce53c
Add empty module_dependencies.txt to make the linter happy
tautschnig Mar 17, 2021
a5b3008
Enable cpplint regression tests
tautschnig Mar 15, 2021
1feb6e4
Merge pull request #5951 from tautschnig/incremental-future-tests
tautschnig Mar 19, 2021
867168c
Fixed the havocing of pointers modified by loops
SaswatPadhi Mar 19, 2021
fdc6865
goto-instrument-wmm: removing graph edges invalidates the iterator
tautschnig Mar 19, 2021
d1da518
Enable regression tests of weak memory model instrumentation
tautschnig Mar 15, 2021
be58114
Add regression tests from goto-instrument-wmm-full.tgz
tautschnig Mar 17, 2021
25c87bc
goto-instrument-wmm tests: minimisation requires glpk
tautschnig Mar 17, 2021
b370f36
goto-instrument-wmm tests: mark failing tests KNOWNBUG
tautschnig Mar 17, 2021
947b913
goto-instrument-wmm tests: flip "THOROUGH" to "CORE"
tautschnig Mar 17, 2021
04466cc
Merge pull request #5956 from tautschnig/symtab2gb-config
martin-cs Mar 20, 2021
e166f4c
Merge pull request #5961 from padhi-aws-forks/loop_modifies_fix
feliperodri Mar 20, 2021
e010007
Merge pull request #5929 from tautschnig/fix-cpplint-action
NlightNFotis Mar 21, 2021
c923c3d
Merge pull request #5937 from tautschnig/wmm-tests
tautschnig Mar 22, 2021
c245183
linux: add compilation script
nmanthey Mar 18, 2021
35d395e
linuxci: test compiling linux
nmanthey Mar 4, 2021
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
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
53 changes: 53 additions & 0 deletions .github/workflows/build-and-test-Linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build Linux partially with CPROVER tools

on:
pull_request:
branches:
- '**'

jobs:
CompileLinux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install Packages
env:
# This is needed in addition to -yq to prevent apt-get from asking for
# user input
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y g++ flex bison cmake ninja-build maven jq libxml2-utils dpkg-dev ccache
sudo apt-get install --no-install-recommends -y libssl-dev libelf-dev libudev-dev libpci-dev libiberty-dev autoconf
sudo apt-get install --no-install-recommends -y gawk jq

- name: Prepare ccache
uses: actions/cache@v2
with:
path: .ccache
key: ${{ runner.os }}-20.04-make-${{ github.ref }}-${{ github.sha }}-KERNEL
restore-keys: |
${{ runner.os }}-20.04-make-${{ github.ref }}
${{ runner.os }}-20.04-make
- name: ccache environment
run: |
echo "CCACHE_BASEDIR=$PWD" >> $GITHUB_ENV
echo "CCACHE_DIR=$PWD/.ccache" >> $GITHUB_ENV
- name: Zero ccache stats and limit in size
run: ccache -z --max-size=500M
- name: Build CBMC tools
run: |
make -C src minisat2-download
make -C src CXX='ccache /usr/bin/g++' cbmc.dir goto-cc.dir goto-diff.dir -j2
- name: Print ccache stats
run: ccache -s

- name: Run (Docker Based) Linux Build test
run: integration/linux/compile_linux.sh

- uses: actions/upload-artifact@v2
with:
name: CPROVER-faultyInput
path: CPROVER/faultyInput/*
3 changes: 2 additions & 1 deletion .github/workflows/pull-request-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ jobs:
# user input
DEBIAN_FRONTEND: noninteractive
run: |
pip install unidiff
sudo apt-get update
sudo apt-get install --no-install-recommends -yq python3-unidiff
- name: Check updated lines of code meet linting standards
env:
BASE_BRANCH: ${{ github.base_ref }}
Expand Down
89 changes: 89 additions & 0 deletions integration/linux/compile_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/bash

# Fail on errors
# set -e # not for now

# Show steps we execute
set -x

# This script needs to operate in the root directory of the CBMC repository
SCRIPT=$(readlink -e "$0")
readonly SCRIPT
SCRIPTDIR=$(dirname "$SCRIPT")
readonly SCRIPTDIR
cd "$SCRIPTDIR/../.."

# Build CBMC tools
make -C src minisat2-download
make -C src CXX='ccache /usr/bin/g++' cbmc.dir goto-cc.dir goto-diff.dir -j$(nproc)

# Get one-line-scan, if we do not have it already
[ -d one-line-scan ] || git clone https://github.com/awslabs/one-line-scan.git one-line-scan

# Get Linux v5.10, if we do not have it already
[ -d linux_5_10 ] || git clone -b v5.10 --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux_5_10

# Prepare compile a part of the kernel with CBMC via one-line-scan
ln -s goto-cc src/goto-cc/goto-ld
ln -s goto-cc src/goto-cc/goto-as
ln -s goto-cc src/goto-cc/goto-g++


configure_linux ()
{
pushd linux_5_10

cat > kvm-config <<EOF
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_MULTIUSER=y
CONFIG_NET=y
CONFIG_VIRTUALIZATION=y
CONFIG_HYPERVISOR_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_KVM_GUEST=y
CONFIG_KVM=y
CONFIG_KVM_INTEL=y
CONFIG_KVM_AMD=y
EOF
# using this failed in earlier attempts
export KCONFIG_ALLCONFIG=kvm-config

# using the previous configuration approach for now
make allnoconfig
popd
}

# Configure kernel, and compile all of it
configure_linux
make -C linux_5_10 bzImage -j $(nproc)
ls linux_5_10/arch/x86/kvm/

# Clean files we want to be able to re-compile
find linux_5_10/arch/x86/kvm/ -name "*.o" -delete
ls linux_5_10/arch/x86/kvm/

# Compile Linux with CBMC via one-line-scan, and check for goto-cc section
# Re-Compile with goto-cc, and measure disk space
declare -i STATUS=0
du -h --max-depth=1
one-line-scan/one-line-scan \
--add-to-path $(pwd)/src/cbmc --add-to-path $(pwd)/src/goto-diff --add-to-path $(pwd)/src/goto-cc \
--cbmc \
--no-analysis \
--trunc-existing \
--extra-cflags -Wno-error \
-o CPROVER -j 5 -- \
make -C linux_5_10 bzImage -j $(nproc) || STATUS=$?
du -h --max-depth=1

# Check for faulty input
ls CPROVER/faultyInput/* || true

# Check for produced output in the files we deleted above
ls linux_5_10/arch/x86/kvm/
objdump -h linux_5_10/arch/x86/kvm/x86.o | grep "goto-cc" || STATUS=$?

# Propagate failures
exit "$STATUS"
5 changes: 5 additions & 0 deletions regression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ add_subdirectory(cpp)
add_subdirectory(cbmc-concurrency)
add_subdirectory(cbmc-cover)
add_subdirectory(cbmc-incr-oneloop)
add_subdirectory(cbmc-incr)
add_subdirectory(cbmc-with-incr)
add_subdirectory(array-refinement-with-incr)
add_subdirectory(goto-instrument-wmm-core)
add_subdirectory(goto-instrument-typedef)
add_subdirectory(smt2_solver)
add_subdirectory(smt2_strings)
Expand Down Expand Up @@ -69,6 +73,7 @@ add_subdirectory(validate-trace-xml-schema)
add_subdirectory(cbmc-primitives)
add_subdirectory(goto-interpreter)
add_subdirectory(cbmc-sequentialization)
add_subdirectory(cpp-linter)

if(WITH_MEMORY_ANALYZER)
add_subdirectory(snapshot-harness)
Expand Down
5 changes: 5 additions & 0 deletions regression/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ DIRS = cbmc \
cbmc-concurrency \
cbmc-cover \
cbmc-incr-oneloop \
cbmc-incr \
cbmc-with-incr \
array-refinement-with-incr \
goto-instrument-wmm-core \
goto-instrument-typedef \
smt2_solver \
smt2_strings \
Expand Down Expand Up @@ -42,6 +46,7 @@ DIRS = cbmc \
cbmc-primitives \
goto-interpreter \
cbmc-sequentialization \
cpp-linter \
# Empty last line

ifeq ($(OS),Windows_NT)
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF1/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 11
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF10/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 1
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF11/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 1
^EXIT=10$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF12/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 2
^EXIT=10$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF13/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 1
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF14/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 6
^EXIT=10$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF15/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 11
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF16/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 2
^EXIT=10$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF17/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 9
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF18/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 11
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF19/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 3
^EXIT=10$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF2/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 5
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF20/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 12
^EXIT=10$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF3/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 3 --no-unwinding-assertions
^EXIT=10$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF4/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 2
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF5/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 2
^EXIT=10$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF6/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 3
^EXIT=10$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF7/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 3
^EXIT=10$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF8/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 6
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/array-refinement-with-incr/Array_UF9/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
FUTURE
main.c
--arrays-uf-always --no-propagation --unwind-max 21
^EXIT=10$
Expand Down
3 changes: 3 additions & 0 deletions regression/array-refinement-with-incr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
add_test_pl_tests(
"$<TARGET_FILE:cbmc> --incremental"
)
18 changes: 18 additions & 0 deletions regression/cbmc-cpp/Address_of_Method1/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <cassert>
struct x
{
void f();

static int i;
};

void x::f()
{
}

int main()
{
assert(&x::f != 0);

assert(&x::i != 0);
}
8 changes: 8 additions & 0 deletions regression/cbmc-cpp/Address_of_Method1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
KNOWNBUG winbug macos-assert-broken
main.cpp

^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
29 changes: 29 additions & 0 deletions regression/cbmc-cpp/Anonymous_members1/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <cassert>
typedef unsigned DWORD;
typedef signed LONG;
typedef long long LONGLONG;

typedef union _LARGE_INTEGER {
struct
{
DWORD LowPart;
LONG HighPart;
};
struct
{
DWORD LowPart;
LONG HighPart;
} u;

LONGLONG QuadPart;
} LARGE_INTEGER;

int main()
{
LARGE_INTEGER l;

l.QuadPart = 1;
l.LowPart = 2;
l.u.LowPart = 3;
assert(l.LowPart == 3);
}
8 changes: 8 additions & 0 deletions regression/cbmc-cpp/Anonymous_members1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE winbug macos-assert-broken
main.cpp

^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
10 changes: 10 additions & 0 deletions regression/cbmc-cpp/Array1/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
int y[5][4][3][2];

int main()
{
for(int i = 0; i < 5; i++)
for(int j = 0; j < 4; j++)
for(int k = 0; k < 3; k++)
for(int l = 0; l < 2; l++)
y[i][j][k][l] = 2;
}
Loading