GDB copyright headers update after running GDB's copyright.py script.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / lib-types.exp
index c48d547074fa723e16b45cd2ac1082f14d1aaefa..003b218bbef8189d27299563016ac931604429da 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2010-2016 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # This file is part of the GDB testsuite.
 # It tests the types.py module.
 
-if $tracelevel then {
-    strace $tracelevel
-}
-
 load_lib gdb-python.exp
 
-set testfile "lib-types"
-set srcfile ${testfile}.cc
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
-    untested "Couldn't compile ${srcfile}"
+standard_testfile .cc
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
     return -1
 }
 
-# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
@@ -49,9 +37,9 @@ gdb_test_no_output "python import gdb.types"
 # test get_basic_type const stripping
 gdb_test_no_output "python const_class1_obj = gdb.parse_and_eval ('const_class1_obj')"
 gdb_test_no_output "python basic_type_const_class1_obj = gdb.types.get_basic_type (const_class1_obj.type)"
-gdb_test "python print str (const_class1_obj.type)" "const class1"
+gdb_test "python print (str (const_class1_obj.type))" "const class1"
 set test "const stripping"
-gdb_test_multiple "python print str (basic_type_const_class1_obj)" $test {
+gdb_test_multiple "python print (str (basic_type_const_class1_obj))" $test {
     -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" {
        pass $test
     }
@@ -60,9 +48,9 @@ gdb_test_multiple "python print str (basic_type_const_class1_obj)" $test {
 # test get_basic_type volatile stripping
 gdb_test_no_output "python volatile_class1_obj = gdb.parse_and_eval ('volatile_class1_obj')"
 gdb_test_no_output "python basic_type_volatile_class1_obj = gdb.types.get_basic_type (volatile_class1_obj.type)"
-gdb_test "python print str (volatile_class1_obj.type)" "volatile class1"
+gdb_test "python print (str (volatile_class1_obj.type))" "volatile class1"
 set test "volatile stripping"
-gdb_test_multiple "python print str (basic_type_volatile_class1_obj)" $test {
+gdb_test_multiple "python print (str (basic_type_volatile_class1_obj))" $test {
     -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" {
        pass $test
     }
@@ -71,9 +59,9 @@ gdb_test_multiple "python print str (basic_type_volatile_class1_obj)" $test {
 # test get_basic_type volatile+const stripping
 gdb_test_no_output "python const_volatile_class1_obj = gdb.parse_and_eval ('const_volatile_class1_obj')"
 gdb_test_no_output "python basic_type_const_volatile_class1_obj = gdb.types.get_basic_type (const_volatile_class1_obj.type)"
-gdb_test "python print str (const_volatile_class1_obj.type)" "const volatile class1"
+gdb_test "python print (str (const_volatile_class1_obj.type))" "const volatile class1"
 set test "volatile+const stripping"
-gdb_test_multiple "python print str (basic_type_const_volatile_class1_obj)" $test {
+gdb_test_multiple "python print (str (basic_type_const_volatile_class1_obj))" $test {
     -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" {
        pass $test
     }
@@ -82,9 +70,9 @@ gdb_test_multiple "python print str (basic_type_const_volatile_class1_obj)" $tes
 # test get_basic_type typedef stripping
 gdb_test_no_output "python typedef_class1_obj = gdb.parse_and_eval ('typedef_class1_obj')"
 gdb_test_no_output "python basic_type_typedef_class1_obj = gdb.types.get_basic_type (typedef_class1_obj.type)"
-gdb_test "python print str (typedef_class1_obj.type)" "typedef_class1"
+gdb_test "python print (str (typedef_class1_obj.type))" "typedef_class1"
 set test "typedef stripping"
-gdb_test_multiple "python print str (basic_type_typedef_class1_obj)" $test {
+gdb_test_multiple "python print (str (basic_type_typedef_class1_obj))" $test {
     -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" {
        pass $test
     }
@@ -93,9 +81,9 @@ gdb_test_multiple "python print str (basic_type_typedef_class1_obj)" $test {
 # test get_basic_type reference stripping
 gdb_test_no_output "python class1_ref_obj = gdb.parse_and_eval ('class1_ref_obj')"
 gdb_test_no_output "python basic_type_class1_ref_obj = gdb.types.get_basic_type (class1_ref_obj.type)"
-gdb_test "python print str (class1_ref_obj.type)" "class1 &"
+gdb_test "python print (str (class1_ref_obj.type))" "class1 &"
 set test "reference stripping"
-gdb_test_multiple "python print str (basic_type_class1_ref_obj)" $test {
+gdb_test_multiple "python print (str (basic_type_class1_ref_obj))" $test {
     -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" {
        pass $test
     }
@@ -104,9 +92,9 @@ gdb_test_multiple "python print str (basic_type_class1_ref_obj)" $test {
 # test nested typedef stripping
 gdb_test_no_output "python typedef_const_typedef_class1_obj = gdb.parse_and_eval ('typedef_const_typedef_class1_obj')"
 gdb_test_no_output "python basic_type_typedef_const_typedef_class1_obj = gdb.types.get_basic_type (typedef_const_typedef_class1_obj.type)"
-gdb_test "python print str (typedef_class1_obj.type)" "typedef_class1"
+gdb_test "python print (str (typedef_class1_obj.type))" "typedef_class1"
 set test "nested typedef stripping"
-gdb_test_multiple "python print str (basic_type_typedef_const_typedef_class1_obj)" $test {
+gdb_test_multiple "python print (str (basic_type_typedef_const_typedef_class1_obj))" $test {
     -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" {
        pass $test
     }
@@ -115,9 +103,10 @@ gdb_test_multiple "python print str (basic_type_typedef_const_typedef_class1_obj
 # test nested typedef/reference stripping
 gdb_test_no_output "python typedef_const_typedef_class1_ref_obj = gdb.parse_and_eval ('typedef_const_typedef_class1_ref_obj')"
 gdb_test_no_output "python basic_type_typedef_const_typedef_class1_ref_obj = gdb.types.get_basic_type (typedef_const_typedef_class1_ref_obj.type)"
-gdb_test "python print str (typedef_const_typedef_class1_ref_obj.type)" "const typedef_const_typedef_class1_ref"
+if {[test_compiler_info {gcc-*-*}]} { setup_xfail gcc/55641 *-*-* }
+gdb_test "python print (str (typedef_const_typedef_class1_ref_obj.type))" "\[\r\n\]+typedef_const_typedef_class1_ref"
 set test "nested typedef/ref stripping"
-gdb_test_multiple "python print str (basic_type_typedef_const_typedef_class1_ref_obj)" $test {
+gdb_test_multiple "python print (str (basic_type_typedef_const_typedef_class1_ref_obj))" $test {
     -re "\[\r\n\]+class1\[\r\n\]+$gdb_prompt $" {
        pass $test
     }
@@ -125,21 +114,20 @@ gdb_test_multiple "python print str (basic_type_typedef_const_typedef_class1_ref
 
 # test has_field on simple class
 gdb_test_no_output "python class1_obj = gdb.parse_and_eval ('class1_obj')"
-gdb_test "python print gdb.types.has_field (class1_obj.type, 'x')" "True"
-gdb_test "python print gdb.types.has_field (class1_obj.type, 'nope')" "False"
+gdb_test "python print (gdb.types.has_field (class1_obj.type, 'x'))" "True"
+gdb_test "python print (gdb.types.has_field (class1_obj.type, 'nope'))" "False"
 
 # test has_field in base class
 gdb_test_no_output "python subclass1_obj = gdb.parse_and_eval ('subclass1_obj')"
-gdb_test "python print gdb.types.has_field (subclass1_obj.type, 'x')" "True"
+gdb_test "python print (gdb.types.has_field (subclass1_obj.type, 'x'))" "True"
 
 # test make_enum_dict
 gdb_test_no_output "python enum1_obj = gdb.parse_and_eval ('enum1_obj')"
 gdb_test_no_output "python enum1_dict = gdb.types.make_enum_dict (enum1_obj.type)"
-gdb_test_no_output "python enum1_list = enum1_dict.items ()"
-gdb_test_no_output "python enum1_list.sort ()"
-gdb_test "python print enum1_list" {\[\('A', 0L\), \('B', 1L\), \('C', 2L\)\]}
+gdb_test_no_output "python enum1_list = sorted (enum1_dict.items ())"
+gdb_test "python print (enum1_list)" {\[\('A', 0L?\), \('B', 1L?\), \('C', 2L?\)\]}
 
 # test deep_items
 gdb_test_no_output "python struct_a = gdb.lookup_type ('struct A')"
-gdb_test "python print struct_a.keys ()" {\['a', '', 'c', ''\]}
-gdb_test "python print \[k for k,v in gdb.types.deep_items(struct_a)\]" {\['a', 'b0', 'b1', 'bb0', 'bb1', 'bbb0', 'bbb1', 'c', 'dd0', 'dd1', 'd2', 'd3'\]}
+gdb_test "python print (struct_a.keys ())" {\['a', '', 'c', ''\]}
+gdb_test "python print (\[k for k,v in gdb.types.deep_items(struct_a)\])" {\['a', 'b0', 'b1', 'bb0', 'bb1', 'bbb0', 'bbb1', 'c', 'dd0', 'dd1', 'd2', 'd3'\]}
This page took 0.037901 seconds and 4 git commands to generate.