Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print out the libstdc++ version #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions rosetta_compiler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,41 @@ def run_tests( tests, arguments, padding ):
sys.stdout.write("Pass.\n")
return errors

def test_libstdcpp_version( arguments ) :
source = [
"// libdatestamp.cxx\n",
"#include <cstdio>\n",
"\n",
"int main(int argc, char* argv[]){\n",
"#ifdef __GLIBCPP__\n",
" std::printf(\"GLIBCPP: %d\\n\",__GLIBCPP__);\n",
"#endif\n",
"#ifdef __GLIBCXX__\n",
" std::printf(\"GLIBCXX: %d\\n\",__GLIBCXX__);\n",
"#endif\n",
" return 0;\n",
"}\n" ]
open( "test_libstdcpp_version.cc", "w" ).writelines( source );
command = list(arguments) + ["-o", "print_libstdcpp_version.gcc", "test_libstdcpp_version.cc"]
print " ".join(command)
process = subprocess.Popen( command, stdout=subprocess.PIPE, stderr=subprocess.PIPE )
output, error = process.communicate()
if process.returncode != 0 :
print "Failed to compile test_libstdcpp_version"
print "output:", output
print "error:", error
os.remove( "test_libstdcpp_version.cc" )
return
second_command = ["./print_libstdcpp_version.gcc"]
process = subprocess.Popen( second_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE )
output, error = process.communicate()
if process.returncode != 0 :
print "Failed to execute print_libstdcpp_version.gcc"
print output
else:
print "Version for libstdc++: ", output
os.remove( "test_libstdcpp_version.cc" )
os.remove( "print_libstdcpp_version.gcc" )

def main(arguments, verbose):
# Test if the compiler will work
Expand All @@ -269,6 +304,8 @@ def main(arguments, verbose):
print "Testing compiler '%s', reporting as:" % arguments[0]
print '\t', run_and_get_errors( [arguments[0], '--version'], True ).split('\n')[0]

test_libstdcpp_version( arguments )

name_size = max( [len(t)+1 for t in TESTS.keys() + OPTIONAL_TESTS.keys()] )

print "\nMain tests:\n"
Expand Down