3 #include <ozulis/core/io-utils.hh>
4 #include "compile-test.hh"
8 CompileTest::CompileTest()
17 process_
.setBinary(OZULIS_BINARY
);
18 process_
.addArg(source_
.string());
22 // get the source content
23 std::ifstream
is(source_
.string().c_str());
25 ozulis::core::readAll(is
, data
);
28 // get the .ll content
29 boost::filesystem::path
llPath(source_
);
30 llPath
.replace_extension("ll");
31 is
.open(llPath
.string().c_str());
33 ozulis::core::readAll(is
, llvmAsm
);
36 // remove the .ll file
37 boost::filesystem::remove(llPath
);
38 assert(!boost::filesystem::exists(llPath
));
40 // remove the .bc file
41 boost::filesystem::path
bcPath(source_
);
42 bcPath
.replace_extension("bc");
43 boost::filesystem::remove(bcPath
);
44 assert(!boost::filesystem::exists(bcPath
));
46 // remove the binary file
47 boost::filesystem::path
binPath(source_
);
48 binPath
.replace_extension();
49 boost::filesystem::remove(binPath
);
50 assert(!boost::filesystem::exists(binPath
));
52 result_
.details
["source"] = data
;
53 result_
.details
["source-path"] = source_
.string();
54 result_
.details
["assembly"] = llvmAsm
;
55 result_
.details
["assembly-path"] = llPath
.string();
59 CompileTest::set(const std::string
& key
, const std::string
& value
)
64 super_t::set(key
, value
);
68 CompileTest::setSource(const std::string
& source
)
70 source_
= path
.parent_path() / source
;
74 CompileTest::type() const
76 static std::string
type_("CompileTest");