1 // Copyright 2017-2019 VMware, Inc.
2 // SPDX-License-Identifier: BSD-2-Clause
3 //
4 // The BSD-2 license (the License) set forth below applies to all parts of the
5 // Cascade project.  You may not use this file except in compliance with the
6 // License.
7 //
8 // BSD-2 License
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are met:
12 //
13 // 1. Redistributions of source code must retain the above copyright notice, this
14 // list of conditions and the following disclaimer.
15 //
16 // 2. Redistributions in binary form must reproduce the above copyright notice,
17 // this list of conditions and the following disclaimer in the documentation
18 // and/or other materials provided with the distribution.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND
21 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 #include "include/cascade_slave.h"
32 #include "gtest/gtest.h"
33 #include "test/harness.h"
34 
35 using namespace cascade;
36 
main(int argc,char ** argv)37 int main(int argc, char** argv) {
38   ::testing::InitGoogleTest(&argc, argv);
39 
40   CascadeSlave slave;
41   slave.set_listeners("/tmp/fpga_socket", 8800);
42   slave.run();
43 
44   return RUN_ALL_TESTS();
45 }
46 
TEST(one_to_one,hello_1)47 TEST(one_to_one, hello_1) {
48   run_code("regression/remote", "share/cascade/test/regression/simple/hello_1.v", "Hello World");
49 }
TEST(one_to_one,pipeline_1)50 TEST(one_to_one, pipeline_1) {
51   run_code("regression/remote", "share/cascade/test/regression/simple/pipeline_1.v", "0123456789");
52 }
TEST(one_to_one,pipeline_2)53 TEST(one_to_one, pipeline_2) {
54   run_code("regression/remote", "share/cascade/test/regression/simple/pipeline_2.v", "0123456789");
55 }
TEST(one_to_one,io)56 TEST(one_to_one, io) {
57   run_code("regression/remote", "share/cascade/test/regression/simple/io_1.v", "1234512345");
58 }
TEST(one_to_one,bitcoin)59 TEST(one_to_one, bitcoin) {
60   run_code("regression/remote", "share/cascade/test/benchmark/bitcoin/run_4.v", "0000000f 00000093\n");
61 }
TEST(one_to_one,bubble)62 TEST(one_to_one, bubble) {
63   run_code("regression/remote", "share/cascade/test/benchmark/mips32/run_bubble_128.v", "1");
64 }
TEST(one_to_one,regex)65 TEST(one_to_one, regex) {
66   run_code("regression/remote", "share/cascade/test/benchmark/regex/run_disjunct_1.v", "424");
67 }
68 
TEST(many_to_one,bitcoin)69 TEST(many_to_one, bitcoin) {
70   run_concurrent("regression/concurrent", "share/cascade/test/benchmark/bitcoin/run_12.v", "00001314 00001398\n");
71 }
TEST(many_to_one,regex)72 TEST(many_to_one, regex) {
73   run_concurrent("regression/concurrent", "share/cascade/test/benchmark/regex/run_disjunct_1.v", "424");
74 }
TEST(many_to_one,array)75 TEST(many_to_one, array) {
76   run_concurrent("regression/concurrent", "share/cascade/test/benchmark/array/run_5.v", "1048577\n");
77 }
78