about summary refs log tree commit diff homepage
path: root/scripts
diff options
context:
space:
mode:
authorTimotej Kapus <tk1713@ic.ac.uk>2019-03-22 16:00:29 +0000
committerMartinNowack <martin.nowack@gmail.com>2019-04-04 20:37:41 +0100
commit1e6b42fad776a56332d95b2e987bbe468794c306 (patch)
tree994da16e01566ea692b3ee0dadb2a85cf3bc98b9 /scripts
parente60393614f7507c1c5fe7dbf87754d18ed4cd7d0 (diff)
downloadklee-1e6b42fad776a56332d95b2e987bbe468794c306.tar.gz
Add MSan support for sqlite
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build/p-klee-linux-ubuntu-16.04.inc1
-rw-r--r--scripts/build/p-klee.inc3
-rw-r--r--scripts/build/p-sqlite-linux-ubuntu-16.04.inc35
-rw-r--r--scripts/build/p-sqlite.inc55
-rw-r--r--scripts/build/v-klee.inc4
-rw-r--r--scripts/build/v-sanitizer.inc4
-rw-r--r--scripts/build/v-sqlite.inc5
7 files changed, 101 insertions, 6 deletions
diff --git a/scripts/build/p-klee-linux-ubuntu-16.04.inc b/scripts/build/p-klee-linux-ubuntu-16.04.inc
index 5350b633..7748d104 100644
--- a/scripts/build/p-klee-linux-ubuntu-16.04.inc
+++ b/scripts/build/p-klee-linux-ubuntu-16.04.inc
@@ -4,7 +4,6 @@ install_build_dependencies_klee() {
   dependencies=(
     build-essential
     cmake
-    libsqlite3-dev
     python-pip #for lit
     python-setuptools #for lit
     python-wheel #for lit
diff --git a/scripts/build/p-klee.inc b/scripts/build/p-klee.inc
index 5872ba4a..8479a2ca 100644
--- a/scripts/build/p-klee.inc
+++ b/scripts/build/p-klee.inc
@@ -122,6 +122,7 @@ fi
     CMAKE_ARGUMENTS+=("-DENABLE_TCMALLOC=FALSE")
   fi
 
+  CMAKE_PREFIX_PATH+=("${SQLITE_INSTALL_PATH}")
 ###############################################################################
 # KLEE
 ###############################################################################
@@ -209,4 +210,4 @@ get_build_artifacts_klee() {
     setup_build_variables_klee
     echo "${KLEE_BUILD_DIR}"
   )
-}
\ No newline at end of file
+}
diff --git a/scripts/build/p-sqlite-linux-ubuntu-16.04.inc b/scripts/build/p-sqlite-linux-ubuntu-16.04.inc
new file mode 100644
index 00000000..ee5531a2
--- /dev/null
+++ b/scripts/build/p-sqlite-linux-ubuntu-16.04.inc
@@ -0,0 +1,35 @@
+install_build_dependencies_sqlite() { 
+  apt update -y
+
+  dependencies=(
+  build-essential
+    unzip
+    git
+    wget
+  )
+
+  apt -y --no-install-recommends install "${dependencies[@]}"
+}
+install_binary_artifact_sqlite() {
+
+  if [[ "${SANITIZER_SUFFIX}x" != "x" ]]; then
+    return 1
+  fi
+  apt update -y
+  
+  dependencies=(
+    libsqlite3-dev
+  )
+
+  #Install essential dependencies
+  apt -y --no-install-recommends install "${dependencies[@]}"
+}
+
+# Check if the binary artifact is installed
+is_installed_sqlite() {
+	[[ -f /usr/lib/x86_64-linux-gnu/libsqlite3.so ]] || return 1
+}
+
+get_docker_config_id_sqlite() {
+    return 0
+}
diff --git a/scripts/build/p-sqlite.inc b/scripts/build/p-sqlite.inc
new file mode 100644
index 00000000..8f94cc87
--- /dev/null
+++ b/scripts/build/p-sqlite.inc
@@ -0,0 +1,55 @@
+setup_build_variables_sqlite() {
+  SQLITE_SRC_PATH="${BASE}/sqlite-amalgamation-3270200"
+  SQLITE_INSTALL_PATH=${SQLITE_SRC_PATH}
+  SQLITE_SUFFIX="${SANITIZER_SUFFIX}"
+}
+
+download_sqlite() {
+  # Get sqlite release
+  cd "${BASE}"
+  wget "http://www.sqlite.org/2019/sqlite-amalgamation-3270200.zip"
+  unzip "sqlite-amalgamation-3270200.zip"
+}
+
+build_sqlite() { 
+  cd "${SQLITE_SRC_PATH}"
+
+  local CFLAGS=""
+  local COMP=${CC}
+
+  # Check if sanitizers should be used to build stp
+  if [[ "${SANITIZER_SUFFIX}x" != "x" ]]; then
+    CFLAGS="${SANITIZER_C_FLAGS[*]}"
+    COMP=${SANITIZER_C_COMPILER}
+  fi
+
+  ${COMP} ${CFLAGS} -fPIC -o libsqlite3.so -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -shared sqlite3.c 
+}
+
+install_sqlite() {
+  return 0
+}
+
+is_installed_sqlite() {
+  (
+    setup_build_variables_sqlite
+    [[ -f "${SQLITE_INSTALL_PATH}"/libsqlite3.so ]]
+  ) || return 1
+}
+
+setup_artifact_variables_sqlite() {
+  setup_build_variables_sqlite
+}
+
+
+get_docker_config_id_sqlite() {
+    setup_build_variables_sqlite
+    echo "sqlite${SQLITE_SUFFIX}"
+}
+
+get_build_artifacts_sqlite() {
+  (
+    setup_build_variables_sqlite
+    echo "${SQLITE_SRC_PATH}"
+  )
+}
diff --git a/scripts/build/v-klee.inc b/scripts/build/v-klee.inc
index 7ed69001..62fdf9dd 100644
--- a/scripts/build/v-klee.inc
+++ b/scripts/build/v-klee.inc
@@ -13,7 +13,7 @@ required_variables_check_klee() {
 
 # On which artifacts does KLEE depend on
 artifact_dependency_klee(){
-  local dependencies=("llvm" "solvers" "gtest")
+  local dependencies=("llvm" "solvers" "gtest" "sqlite")
   if [[ "${OS}" != "osx" ]]; then
     dependencies+=(uclibc)
   fi
@@ -31,7 +31,7 @@ runtime_artifact_dependency_klee(){
   if [[ "${OS}" != "osx" ]]; then
     echo "uclibc"
   fi
-  dependencies+=("llvm" "solvers" "gtest")
+  dependencies+=("llvm" "solvers" "gtest" "sqlite")
 
   [[ "${USE_TCMALLOC}" -eq 1 ]] && dependencies+=("tcmalloc")
   [[ "${USE_LIBCXX}" -eq 1 ]] && dependencies+=("libcxx")
diff --git a/scripts/build/v-sanitizer.inc b/scripts/build/v-sanitizer.inc
index 9d605377..6ac9d19f 100644
--- a/scripts/build/v-sanitizer.inc
+++ b/scripts/build/v-sanitizer.inc
@@ -78,7 +78,7 @@ setup_variables_sanitizer() {
       continue
     fi
 
-    # Undefined Behaviour Sanitizer
+    # Memory Sanitizer
     if [ "${sanitizer}" == "memory" ]; then
       echo "Using Memory Sanitizer"
       SANITIZER_SUFFIX+="_memsan"
@@ -88,4 +88,4 @@ setup_variables_sanitizer() {
     echo "Unknown sanitizer: $sanitizer"
     exit 1
   done
-  }
\ No newline at end of file
+  }
diff --git a/scripts/build/v-sqlite.inc b/scripts/build/v-sqlite.inc
new file mode 100644
index 00000000..1a4f7db5
--- /dev/null
+++ b/scripts/build/v-sqlite.inc
@@ -0,0 +1,5 @@
+artifact_dependency_sqlite=("sanitizer_compiler")
+
+required_variables_sqlite=(
+  "CC"
+)