From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 9EBB53858C52 for ; Thu, 19 Jan 2023 12:44:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9EBB53858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B454938AE0 for ; Thu, 19 Jan 2023 12:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1674132289; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=T8xDzaUF8DWE5yaZagt1cPJP/gIjwaa9jJlW+zPQ2LI=; b=Usk3JUQFOpZMNPaFN4nLLYTPx/LQQdeU6XwMD7ufwJDCyljgJbYQmNUFtOWL/WrSWRzX1X Npgrs2vIqUmMEvff2lYxVOc0VJdph+AUvHv/cWa7vksBljDqLmD0q/VU7e9mXx3ewmPB+m rSFqw6Z2bYGRkycTSl0wp8/pHUGSkgU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1674132289; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=T8xDzaUF8DWE5yaZagt1cPJP/gIjwaa9jJlW+zPQ2LI=; b=FxVGVrH9maNo6Jag+Tim8oInaJAUqrm8F/epFrWeywKdMBV9gvGTajsrt4lZIGhTbgNh7I oa9zDPuz/K5pR5AA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A1134139ED for ; Thu, 19 Jan 2023 12:44:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +UQmJkE7yWOCaAAAMHmgww (envelope-from ) for ; Thu, 19 Jan 2023 12:44:49 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [pushed] [gdb/testsuite] Fix gdb.python/py-value-cc.exp for big endian Date: Thu, 19 Jan 2023 13:44:49 +0100 Message-Id: <20230119124449.18628-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On s390x-linux, I run into: ... (gdb) python print(u[u_fields[0]])^M 99^M (gdb) PASS: gdb.python/py-value-cc.exp: u's first field via field python print(u[u_fields[1]])^M 0 '\000'^M (gdb) FAIL: gdb.python/py-value-cc.exp: u's second field via field ... There's a var u of this type: ... union U { int a; char c; }; ... and after assigning 99 to u.a, the test-case expects u.c to contain 99 (which it does on x86_64), but instead it contains 0. Fix this by instead assigning 0x63636363, to ensure that u.c == 99 for both little and big endian. Tested on x86_64-linux and s390x-linux. --- gdb/testsuite/gdb.python/py-value-cc.cc | 2 +- gdb/testsuite/gdb.python/py-value-cc.exp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.python/py-value-cc.cc b/gdb/testsuite/gdb.python/py-value-cc.cc index 817b089c35f..d82e385d6c5 100644 --- a/gdb/testsuite/gdb.python/py-value-cc.cc +++ b/gdb/testsuite/gdb.python/py-value-cc.cc @@ -77,7 +77,7 @@ func (const A &a) Btd &b_td = b1; U u; - u.a = 99; + u.a = 0x63636363; X x; x.x = 101; diff --git a/gdb/testsuite/gdb.python/py-value-cc.exp b/gdb/testsuite/gdb.python/py-value-cc.exp index 1ea10ad0058..b6571cd8297 100644 --- a/gdb/testsuite/gdb.python/py-value-cc.exp +++ b/gdb/testsuite/gdb.python/py-value-cc.exp @@ -80,7 +80,8 @@ gdb_test "python print(b_td\[b_fields\[0\]\].type.target())" "A" \ gdb_test "python print(b_td\[b_fields\[0\]\]\['a'\])" "100" \ "b_td.A::a via field" -gdb_test "python print(u\[u_fields\[0\]\])" "99.*" "u's first field via field" +gdb_test "python print(hex(u\[u_fields\[0\]\]))" "0x63636363.*" \ + "u's first field via field" gdb_test "python print(u\[u_fields\[1\]\])" "99.*" "u's second field via field" gdb_test "python print(len(x_fields))" "2" "number for fields in u" base-commit: 75c2efc6f19fe454413aa70d2c37e543f04a67e1 -- 2.35.3