summaryrefslogtreecommitdiffstats
path: root/test cases/failing build
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/failing build')
-rw-r--r--test cases/failing build/1 vala c werror/meson.build10
-rw-r--r--test cases/failing build/1 vala c werror/prog.vala7
-rw-r--r--test cases/failing build/1 vala c werror/unused-var.c8
-rw-r--r--test cases/failing build/2 hidden symbol/bob.c5
-rw-r--r--test cases/failing build/2 hidden symbol/bob.h3
-rw-r--r--test cases/failing build/2 hidden symbol/bobuser.c5
-rw-r--r--test cases/failing build/2 hidden symbol/meson.build11
-rw-r--r--test cases/failing build/3 pch disabled/c/meson.build2
-rw-r--r--test cases/failing build/3 pch disabled/c/pch/prog.h1
-rw-r--r--test cases/failing build/3 pch disabled/c/pch/prog_pch.c5
-rw-r--r--test cases/failing build/3 pch disabled/c/prog.c9
-rw-r--r--test cases/failing build/3 pch disabled/meson.build5
-rw-r--r--test cases/failing build/4 cmake subproject isolation/incDir/fileA.hpp3
-rw-r--r--test cases/failing build/4 cmake subproject isolation/main.cpp10
-rw-r--r--test cases/failing build/4 cmake subproject isolation/meson.build17
-rw-r--r--test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/CMakeLists.txt10
-rw-r--r--test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.cpp12
-rw-r--r--test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.hpp14
-rw-r--r--test cases/failing build/4 cmake subproject isolation/test.json5
-rw-r--r--test cases/failing build/5 failed pickled/false.py4
-rw-r--r--test cases/failing build/5 failed pickled/meson.build7
21 files changed, 153 insertions, 0 deletions
diff --git a/test cases/failing build/1 vala c werror/meson.build b/test cases/failing build/1 vala c werror/meson.build
new file mode 100644
index 0000000..736d7aa
--- /dev/null
+++ b/test cases/failing build/1 vala c werror/meson.build
@@ -0,0 +1,10 @@
+project('valatest', 'c', default_options : 'werror=true')
+
+if find_program('valac', required : false).found()
+ add_languages('vala')
+ valadeps = [dependency('glib-2.0'), dependency('gobject-2.0')]
+ # Must fail due to -Werror and unused variable in C file
+ executable('valaprog', 'prog.vala', 'unused-var.c', dependencies : valadeps)
+else
+ executable('failprog', 'unused-var.c')
+endif
diff --git a/test cases/failing build/1 vala c werror/prog.vala b/test cases/failing build/1 vala c werror/prog.vala
new file mode 100644
index 0000000..638e776
--- /dev/null
+++ b/test cases/failing build/1 vala c werror/prog.vala
@@ -0,0 +1,7 @@
+class MainProg : GLib.Object {
+
+ public static int main(string[] args) {
+ stdout.printf("Vala is working.\n");
+ return 0;
+ }
+}
diff --git a/test cases/failing build/1 vala c werror/unused-var.c b/test cases/failing build/1 vala c werror/unused-var.c
new file mode 100644
index 0000000..6b85078
--- /dev/null
+++ b/test cases/failing build/1 vala c werror/unused-var.c
@@ -0,0 +1,8 @@
+#warning "something"
+
+int
+somelib(void)
+{
+ int unused_var;
+ return 33;
+}
diff --git a/test cases/failing build/2 hidden symbol/bob.c b/test cases/failing build/2 hidden symbol/bob.c
new file mode 100644
index 0000000..9a3325a
--- /dev/null
+++ b/test cases/failing build/2 hidden symbol/bob.c
@@ -0,0 +1,5 @@
+#include"bob.h"
+
+int hidden_function() {
+ return 7;
+}
diff --git a/test cases/failing build/2 hidden symbol/bob.h b/test cases/failing build/2 hidden symbol/bob.h
new file mode 100644
index 0000000..947f6ee
--- /dev/null
+++ b/test cases/failing build/2 hidden symbol/bob.h
@@ -0,0 +1,3 @@
+#pragma once
+
+int hidden_function();
diff --git a/test cases/failing build/2 hidden symbol/bobuser.c b/test cases/failing build/2 hidden symbol/bobuser.c
new file mode 100644
index 0000000..89272ed
--- /dev/null
+++ b/test cases/failing build/2 hidden symbol/bobuser.c
@@ -0,0 +1,5 @@
+#include"bob.h"
+
+int main(int argc, char **argv) {
+ return hidden_function();
+}
diff --git a/test cases/failing build/2 hidden symbol/meson.build b/test cases/failing build/2 hidden symbol/meson.build
new file mode 100644
index 0000000..f7c38e3
--- /dev/null
+++ b/test cases/failing build/2 hidden symbol/meson.build
@@ -0,0 +1,11 @@
+project('hidden symbol', 'c')
+
+if host_machine.system() == 'windows' or host_machine.system() == 'cygwin'
+ error('MESON_SKIP_TEST -fvisibility=hidden does not work for PE files.')
+endif
+
+l = shared_library('bob', 'bob.c',
+ gnu_symbol_visibility: 'hidden')
+
+executable('bobuser', 'bobuser.c',
+ link_with: l)
diff --git a/test cases/failing build/3 pch disabled/c/meson.build b/test cases/failing build/3 pch disabled/c/meson.build
new file mode 100644
index 0000000..1739126
--- /dev/null
+++ b/test cases/failing build/3 pch disabled/c/meson.build
@@ -0,0 +1,2 @@
+exe = executable('prog', 'prog.c',
+c_pch : ['pch/prog_pch.c', 'pch/prog.h'])
diff --git a/test cases/failing build/3 pch disabled/c/pch/prog.h b/test cases/failing build/3 pch disabled/c/pch/prog.h
new file mode 100644
index 0000000..354499a
--- /dev/null
+++ b/test cases/failing build/3 pch disabled/c/pch/prog.h
@@ -0,0 +1 @@
+#include<stdio.h>
diff --git a/test cases/failing build/3 pch disabled/c/pch/prog_pch.c b/test cases/failing build/3 pch disabled/c/pch/prog_pch.c
new file mode 100644
index 0000000..4960505
--- /dev/null
+++ b/test cases/failing build/3 pch disabled/c/pch/prog_pch.c
@@ -0,0 +1,5 @@
+#if !defined(_MSC_VER)
+#error "This file is only for use with MSVC."
+#endif
+
+#include "prog.h"
diff --git a/test cases/failing build/3 pch disabled/c/prog.c b/test cases/failing build/3 pch disabled/c/prog.c
new file mode 100644
index 0000000..f17bc9e
--- /dev/null
+++ b/test cases/failing build/3 pch disabled/c/prog.c
@@ -0,0 +1,9 @@
+// No includes here, they need to come from the PCH
+
+void func() {
+ fprintf(stdout, "This is a function that fails if stdio is not #included.\n");
+}
+
+int main(int argc, char **argv) {
+ return 0;
+}
diff --git a/test cases/failing build/3 pch disabled/meson.build b/test cases/failing build/3 pch disabled/meson.build
new file mode 100644
index 0000000..0a8fa67
--- /dev/null
+++ b/test cases/failing build/3 pch disabled/meson.build
@@ -0,0 +1,5 @@
+# Disable PCH usage to make sure backends respect this setting.
+# Since the .c file requires PCH usage (it does not include necessary
+# headers itself), the build should fail.
+project('pch test', 'c', default_options: ['b_pch=false'])
+subdir('c')
diff --git a/test cases/failing build/4 cmake subproject isolation/incDir/fileA.hpp b/test cases/failing build/4 cmake subproject isolation/incDir/fileA.hpp
new file mode 100644
index 0000000..a5f09be
--- /dev/null
+++ b/test cases/failing build/4 cmake subproject isolation/incDir/fileA.hpp
@@ -0,0 +1,3 @@
+#pragma once
+
+#define SOME_DEFINE " World"
diff --git a/test cases/failing build/4 cmake subproject isolation/main.cpp b/test cases/failing build/4 cmake subproject isolation/main.cpp
new file mode 100644
index 0000000..9507961
--- /dev/null
+++ b/test cases/failing build/4 cmake subproject isolation/main.cpp
@@ -0,0 +1,10 @@
+#include <iostream>
+#include <cmMod.hpp>
+
+using namespace std;
+
+int main(void) {
+ cmModClass obj("Hello");
+ cout << obj.getStr() << endl;
+ return 0;
+}
diff --git a/test cases/failing build/4 cmake subproject isolation/meson.build b/test cases/failing build/4 cmake subproject isolation/meson.build
new file mode 100644
index 0000000..e606335
--- /dev/null
+++ b/test cases/failing build/4 cmake subproject isolation/meson.build
@@ -0,0 +1,17 @@
+project('subproject isolation', ['c', 'cpp'])
+
+if not find_program('cmake', required: false).found()
+ error('MESON_SKIP_TEST CMake is not installed')
+endif
+
+incdir = meson.source_root() / 'incDir'
+
+cm = import('cmake')
+
+# This should generate a warning and the include dir should be skipped.
+sub_pro = cm.subproject('cmMod', cmake_options : [ '-DMESON_INC_DIR=' + incdir ])
+sub_dep = sub_pro.dependency('cmModLib++')
+
+# Since the include dir is skipped, the compilation of this project should fail.
+exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep])
+test('test1', exe1)
diff --git a/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/CMakeLists.txt b/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/CMakeLists.txt
new file mode 100644
index 0000000..852dd09
--- /dev/null
+++ b/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 3.5)
+
+project(cmMod)
+set (CMAKE_CXX_STANDARD 14)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR} ${MESON_INC_DIR})
+
+add_library(cmModLib++ SHARED cmMod.cpp)
+include(GenerateExportHeader)
+generate_export_header(cmModLib++)
diff --git a/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.cpp b/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.cpp
new file mode 100644
index 0000000..a668203
--- /dev/null
+++ b/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.cpp
@@ -0,0 +1,12 @@
+#include "cmMod.hpp"
+#include "fileA.hpp"
+
+using namespace std;
+
+cmModClass::cmModClass(string foo) {
+ str = foo + SOME_DEFINE;
+}
+
+string cmModClass::getStr() const {
+ return str;
+}
diff --git a/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.hpp b/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.hpp
new file mode 100644
index 0000000..0e6dc04
--- /dev/null
+++ b/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.hpp
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "cmmodlib++_export.h"
+#include <string>
+
+class CMMODLIB___EXPORT cmModClass {
+private:
+ std::string str;
+
+public:
+ cmModClass(std::string foo);
+
+ std::string getStr() const;
+};
diff --git a/test cases/failing build/4 cmake subproject isolation/test.json b/test cases/failing build/4 cmake subproject isolation/test.json
new file mode 100644
index 0000000..b48d78a
--- /dev/null
+++ b/test cases/failing build/4 cmake subproject isolation/test.json
@@ -0,0 +1,5 @@
+{
+ "tools": {
+ "cmake": ">=3.14"
+ }
+}
diff --git a/test cases/failing build/5 failed pickled/false.py b/test cases/failing build/5 failed pickled/false.py
new file mode 100644
index 0000000..865aeb9
--- /dev/null
+++ b/test cases/failing build/5 failed pickled/false.py
@@ -0,0 +1,4 @@
+#!/usr/bin/env python3
+
+import sys
+sys.exit(1)
diff --git a/test cases/failing build/5 failed pickled/meson.build b/test cases/failing build/5 failed pickled/meson.build
new file mode 100644
index 0000000..9245020
--- /dev/null
+++ b/test cases/failing build/5 failed pickled/meson.build
@@ -0,0 +1,7 @@
+project('failed pickled command')
+
+custom_target('failure',
+ command: [find_program('false.py'), '\n'],
+ output: 'output.txt',
+ build_by_default: true,
+)