Home | History | Annotate | Download | only in compiler
      1 /*
      2  * Copyright 2017, The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *     http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #include "Builtin.h"
     18 
     19 #include "file_utils.h"
     20 #include "pass_queue.h"
     21 #include "spirit.h"
     22 #include "test_utils.h"
     23 #include "gtest/gtest.h"
     24 
     25 namespace android {
     26 namespace spirit {
     27 
     28 TEST(BuiltinTest, testBuiltinTranslation) {
     29   const std::string testFile("greyscale.spv");
     30   const std::string testDataPath(
     31       "frameworks/rs/rsov/compiler/spirit/test_data/");
     32   const std::string &fullPath = getAbsolutePath(testDataPath + testFile);
     33   auto words = readFile<uint32_t>(fullPath);
     34 
     35   PassQueue passes;
     36   passes.append(rs2spirv::CreateBuiltinPass());
     37   auto words1 = passes.run(words);
     38 
     39   std::unique_ptr<Module> m1(Deserialize<Module>(words1));
     40 
     41   ASSERT_NE(nullptr, m1);
     42 }
     43 
     44 } // spirit
     45 } // android
     46