Fix build warnings on ppc64le and s390x
Ondrej Mosnáček
reviewercover Fix build warnings on ppc64le and s390x
This series fixes build warnings on some architectures that became fatal after -Werror was added to build flags. It also adds a simple compile test to the CI that runs make all on all architectures supported by Fedora, so that they can be discovered earlier in the future.
Ondrej Mosnáček (4):
tests/binder: fix compiler warnings on ppc64le tests/perf_event: fix compiler warnings on ppc64le tests/filesystem/statfs_test.c: fix a compiler warning on s390x tmt,ci: add a mutli-arch compile test
.github/workflows/checks.yml | 13 ++++++++ tests/binder/binder_common.c | 36 +++++++++++----------- tests/binder/check_binder.c | 8 ++--- tests/binder/check_binderfs.c | 10 +++--- tests/binder/client.c | 36 +++++++++++----------- tests/binder/manager.c | 37 +++++++++++----------- tests/binder/service_provider.c | 22 +++++++------- tests/filesystem/statfs_test.c | 2 +- tests/perf_event/perf_event.c | 2 +- tmt/README.md | 2 +- tmt/plans.fmf | 11 ++++++- tmt/tests.fmf | 54 +++++++++++++++++++++++++++++++++ 12 files changed, 155 insertions(+), 78 deletions(-)
Signature · 1 line
2.54.0
Ondrej Mosnáček
reviewerPATCH 1/4 tests/binder: fix compiler warnings on ppc64le
Use the correct format specifiers and casts to make sure that the code compiles and works correctly on all architectures. This particularly fixes compiler warnings on ppc64le, which are now treated as errors.
--- tests/binder/binder_common.c | 36 ++++++++++++++++---------------- tests/binder/check_binder.c | 8 +++---- tests/binder/check_binderfs.c | 10 ++++----- tests/binder/client.c | 36 ++++++++++++++++---------------- tests/binder/manager.c | 37 +++++++++++++++++---------------- tests/binder/service_provider.c | 22 ++++++++++---------- 6 files changed, 75 insertions(+), 74 deletions(-)
tests/binder/binder_common.c +18 -18
@@ -64,8 +64,8 @@ void print_trans_data(const struct binder_transaction_data *txn_in) (binder_uintptr_t )txn_in->data.ptr.offsets;size_t count = txn_in->offsets_size /sizeof (binder_size_t); -printf ("\thandle: %d\n" , (uint32_t )txn_in->target.handle); -printf ("\tcookie: %lld\n" , txn_in->cookie); +printf ("\thandle: %lu\n" , (long unsigned )txn_in->target.handle); +printf ("\tcookie: %llu\n" , (long long unsigned )txn_in->cookie);switch (txn_in->code) {case TEST_SERVICE_ADD :printf ("\tcode: TEST_SERVICE_ADD\n" );
@@ -77,8 +77,8 @@ void print_trans_data(const struct binder_transaction_data *txn_in)printf ("\tcode: TEST_SERVICE_SEND_FD\n" );break ;default : -printf ("Unknown binder_transaction_data->code: %x\n" , - txn_in->code); +printf ("Unknown binder_transaction_data->code: %lx\n" , + (long unsigned )txn_in->code);return ; }
@@ -96,13 +96,13 @@ void print_trans_data(const struct binder_transaction_data *txn_in)printf ("\tflag: TF_ACCEPT_FDS\n" );break ;default : -printf ("Unknown flag: %x\n" , txn_in->flags); +printf ("Unknown flag: %lx\n" , (long unsigned )txn_in->flags);return ; } -printf ("\tsender pid: %u\n" , txn_in->sender_pid); -printf ("\tsender euid: %u\n" , txn_in->sender_euid); -printf ("\tdata_size: %llu\n" , txn_in->data_size); -printf ("\toffsets_size: %llu\n" , txn_in->offsets_size); +printf ("\tsender pid: %ld\n" , (long )txn_in->sender_pid); +printf ("\tsender euid: %lu\n" , (long unsigned )txn_in->sender_euid); +printf ("\tdata_size: %llu\n" , (long long unsigned )txn_in->data_size); +printf ("\toffsets_size: %llu\n" , (long long unsigned )txn_in->offsets_size);while (count--) { obj = (const struct flat_binder_object *)
@@ -111,31 +111,31 @@ void print_trans_data(const struct binder_transaction_data *txn_in)switch (obj->hdr.type) {case BINDER_TYPE_BINDER :printf ("\thdr: BINDER_TYPE_BINDER\n" ); -printf ("\tbinder: %llx\n" , obj->binder); +printf ("\tbinder: %llx\n" , (long long unsigned )obj->binder);break ;case BINDER_TYPE_HANDLE :printf ("\thdr: BINDER_TYPE_HANDLE\n" ); -printf ("\thandle: %x\n" , obj->handle); +printf ("\thandle: %lx\n" , (long unsigned )obj->handle);break ;case BINDER_TYPE_FD :printf ("\thdr: BINDER_TYPE_FD\n" ); -printf ("\tfd: %x\n" , obj->handle); +printf ("\tfd: %lx\n" , (long unsigned )obj->handle);break ;default : -printf ("Unknown header: %u\n" , obj->hdr.type); +printf ("Unknown header: %lu\n" , (long unsigned )obj->hdr.type);return ; }#if HAVE_BINDERFS -printf ("\tflags: priority: 0x%x accept FDS: %s request security CTX: %s\n" , - obj->flags &FLAT_BINDER_FLAG_PRIORITY_MASK , +printf ("\tflags: priority: 0x%lx accept FDS: %s request security CTX: %s\n" , + (long unsigned )obj->flags &FLAT_BINDER_FLAG_PRIORITY_MASK , obj->flags &FLAT_BINDER_FLAG_ACCEPTS_FDS ?"YES" :"NO" , obj->flags &FLAT_BINDER_FLAG_TXN_SECURITY_CTX ?"YES" :"NO" );#else -printf ("\tflags: priority: 0x%x accept FDS: %s\n" , - obj->flags &FLAT_BINDER_FLAG_PRIORITY_MASK , +printf ("\tflags: priority: 0x%lx accept FDS: %s\n" , + (long unsigned )obj->flags &FLAT_BINDER_FLAG_PRIORITY_MASK , obj->flags &FLAT_BINDER_FLAG_ACCEPTS_FDS ?"YES" :"NO" );#endif -printf ("\tcookie: %llx\n" , obj->cookie); +printf ("\tcookie: %llx\n" , (long long unsigned )obj->cookie); }fflush (stdout); }
tests/binder/check_binder.c +4 -4
@@ -41,15 +41,15 @@ int main(int argc, char **argv)if (vers.protocol_version !=BINDER_CURRENT_PROTOCOL_VERSION ) {fprintf (stderr, -"Binder kernel version: %d differs from user space version: %d\n" , - vers.protocol_version, -BINDER_CURRENT_PROTOCOL_VERSION ); +"Binder kernel version: %ld differs from user space version: %ld\n" , + (long )vers.protocol_version, + (long )BINDER_CURRENT_PROTOCOL_VERSION ); result =BINDER_VER_ERROR ; goto brexit; }if (verbose) -printf ("Binder kernel version: %d\n" , vers.protocol_version); +printf ("Binder kernel version: %ld\n" , (long )vers.protocol_version); result =BASE_BINDER_SUPPORT ;
tests/binder/check_binderfs.c +5 -5
@@ -47,7 +47,7 @@ int main(int argc, char *argv[])if (verbose)printf ("Allocated new binder device: major %d minor %d" -" with name \"%s\"\n" , device.major, device.minor, +" with name \"%s\"\n" , (int )device.major, (int )device.minor, device.name); result =sprintf (dev_str,"%s/%s" ,BINDERFS_DEV ,BINDERFS_NAME );
@@ -76,14 +76,14 @@ int main(int argc, char *argv[])if (vers.protocol_version !=BINDER_CURRENT_PROTOCOL_VERSION ) {fprintf (stderr, -"Binder kernel version: %d differs from user space version: %d\n" , - vers.protocol_version, -BINDER_CURRENT_PROTOCOL_VERSION ); +"Binder kernel version: %ld differs from user space version: %ld\n" , + (long )vers.protocol_version, + (long )BINDER_CURRENT_PROTOCOL_VERSION ); result =BINDER_VER_ERROR ; goto brexit; }if (verbose) -printf ("Binder kernel version: %d\n" , vers.protocol_version); +printf ("Binder kernel version: %ld\n" , (long )vers.protocol_version); result =BINDERFS_SUPPORT ;
tests/binder/client.c +18 -18
@@ -56,8 +56,8 @@ static void extract_fd_and_respond(const struct binder_transaction_data *txn_in) (((char *)(binder_uintptr_t )txn_in->data.ptr.buffer) + *offs);if (obj->hdr.type !=BINDER_TYPE_FD ) { -fprintf (stderr,"Header not BINDER_TYPE_FD: %d\n" , - obj->hdr.type); +fprintf (stderr,"Header not BINDER_TYPE_FD: %lu\n" , + (long unsigned )obj->hdr.type);exit (130 ); }
@@ -69,8 +69,8 @@ static void extract_fd_and_respond(const struct binder_transaction_data *txn_in) }if (verbose) -printf ("Client retrieved %s fd: %d st_dev: %ld\n" , - fd_type_str, obj->fd, sb.st_dev); +printf ("Client retrieved %s fd: %d st_dev: %llu\n" , + fd_type_str, obj->fd, (long long unsigned )sb.st_dev);/* If testing BPF, then cannot do impersonate check */ if (fd_type >BINDER_FD )
@@ -110,8 +110,8 @@ static void extract_fd_and_respond(const struct binder_transaction_data *txn_in) }if (verbose) -printf ("Client read_consumed: %lld\n" , - bwr.read_consumed); +printf ("Client read_consumed: %llu\n" , + (long long unsigned )bwr.read_consumed); cmd =binder_parse (obj->fd, (binder_uintptr_t )readbuf, bwr.read_consumed);
@@ -163,8 +163,8 @@ static void request_service_provider_fd(int fd, uint32_t handle) bwr.read_buffer = (binder_uintptr_t )readbuf;if (verbose) -printf ("Client sending transaction SEND_CLIENT_YOUR_BINDER_FD to handle: %d\n" , - handle); +printf ("Client sending transaction SEND_CLIENT_YOUR_BINDER_FD to handle: %lu\n" , + (long unsigned )handle); result =ioctl (fd,BINDER_WRITE_READ , &bwr);if (result <0 ) {
@@ -198,8 +198,8 @@ static void extract_handle_and_acquire(int fd, (((char *)(binder_uintptr_t )txn_in->data.ptr.buffer) + *offs);if (obj->hdr.type !=BINDER_TYPE_HANDLE ) { -fprintf (stderr,"Client - Header not BINDER_TYPE_HANDLE: %d\n" , - obj->hdr.type); +fprintf (stderr,"Client - Header not BINDER_TYPE_HANDLE: %lu\n" , + (long unsigned )obj->hdr.type);exit (150 ); }
@@ -219,8 +219,8 @@ static void extract_handle_and_acquire(int fd, }if (verbose) -printf ("Client acquired binder handle: %d for Service Provider\n" , - obj->handle); +printf ("Client acquired binder handle: %lu for Service Provider\n" , + (long unsigned )obj->handle);/* Now get their fd */ request_service_provider_fd (fd, obj->handle);
@@ -291,8 +291,8 @@ static int binder_parse(int fd, binder_uintptr_t ptr, binder_size_t size)break ;default :if (verbose) -printf ("Client parsed unknown command: %d\n" , - cmd); +printf ("Client parsed unknown command: %lu\n" , + (long unsigned )cmd);exit (160 ); } }
@@ -358,8 +358,8 @@ int main(int argc, char **argv) pid =getpid ();if (verbose) { -printf ("Client PID: %d Process context:\n\t%s\n" , - pid, context); +printf ("Client PID: %ld Process context:\n\t%s\n" , + (long )pid, context); }free (context);
@@ -434,8 +434,8 @@ int main(int argc, char **argv) ioctl_wr++;if (verbose) -printf ("Client read_consumed: %lld\n" , - bwr.read_consumed); +printf ("Client read_consumed: %llu\n" , + (long long unsigned )bwr.read_consumed); cmd =binder_parse (fd, (binder_uintptr_t )readbuf, bwr.read_consumed);
tests/binder/manager.c +19 -18
@@ -45,8 +45,8 @@ static void do_service_manager(int fd, struct binder_transaction_data *txn_in) sp_handle = obj->handle;if (verbose) -printf ("Manager has TEST_SERVICE_ADD obj->handle: %d\n" , - sp_handle); +printf ("Manager has TEST_SERVICE_ADD obj->handle: %lu\n" , + (long unsigned )sp_handle); }else {fprintf (stderr,"Manager failed to obtain a handle\n" );exit (20 );
@@ -68,8 +68,8 @@ static void do_service_manager(int fd, struct binder_transaction_data *txn_in) }if (verbose) -printf ("Manager acquired binder handle: %d for Service Provider\n" , - sp_handle); +printf ("Manager acquired binder handle: %lu for Service Provider\n" , + (long unsigned )sp_handle);/* Inform the Service Provider of outcome. */ reply.cmd_reply =BC_REPLY ;
@@ -85,20 +85,21 @@ static void do_service_manager(int fd, struct binder_transaction_data *txn_in)break ;case TEST_SERVICE_GET :if (verbose) -printf ("Manager has TEST_SERVICE_GET handle: %d\n" , - sp_handle); +printf ("Manager has TEST_SERVICE_GET handle: %lu\n" , + (long unsigned )sp_handle);reply_with_handle (fd, txn_in);break ;case TEST_SERVICE_SEND_FD :if (verbose) -printf ("Manager Rx'ed SEND_CLIENT_YOUR_BINDER_FD for handle: %d\n" , - txn_in->target.handle); +printf ("Manager Rx'ed SEND_CLIENT_YOUR_BINDER_FD for handle: %lu\n" , + (long unsigned )txn_in->target.handle);break ;default : -fprintf (stderr,"Manager unknown txn->code: %d for handle: %d\n" , - txn_in->code, txn_in->target.handle); +fprintf (stderr,"Manager unknown txn->code: %lu for handle: %lu\n" , + (long unsigned )txn_in->code, + (long unsigned )txn_in->target.handle);exit (22 ); } }
@@ -148,8 +149,8 @@ static void reply_with_handle(int fd, struct binder_transaction_data *txn_in) }if (verbose) -printf ("Manager sent Service Provider handle: %d to Client\n" , - sp_handle); +printf ("Manager sent Service Provider handle: %lu to Client\n" , + (long unsigned )sp_handle); }/* Parse response, reply as required and then return last CMD */
@@ -210,8 +211,8 @@ static int binder_parse(int fd, binder_uintptr_t ptr, binder_size_t size)break ;default :if (verbose) -printf ("Manager parsed unknown command: %d\n" , - cmd); +printf ("Manager parsed unknown command: %lu\n" , + (long unsigned )cmd);exit (40 ); } }
@@ -258,8 +259,8 @@ int main(int argc, char **argv) pid =getpid ();if (verbose) { -printf ("Manager PID: %d Process context:\n\t%s\n" , - pid, context); +printf ("Manager PID: %ld Process context:\n\t%s\n" , + (long )pid, context); }free (context);
@@ -348,8 +349,8 @@ int main(int argc, char **argv)continue ;if (verbose) -printf ("Manager read_consumed: %lld\n" , - bwr.read_consumed); +printf ("Manager read_consumed: %llu\n" , + (long long unsigned )bwr.read_consumed);binder_parse (fd, (binder_uintptr_t )readbuf, bwr.read_consumed); }
tests/binder/service_provider.c +11 -11
@@ -95,13 +95,13 @@ static void request_service_provider_fd(int fd,break ;#endif default : -fprintf (stderr,"Invalid fd_type: %d\n" , fd_type); +fprintf (stderr,"Invalid fd_type: %d\n" , (int )fd_type);exit (73 ); }if (verbose) -printf ("Service Provider handle: %d and %s FD: %d\n" , - txn->target.handle, fd_type_str, obj.fd); +printf ("Service Provider handle: %lu and %s FD: %d\n" , + (long unsigned )txn->target.handle, fd_type_str, obj.fd); txn->data_size =sizeof (obj); txn->data.ptr.buffer = (binder_uintptr_t)&obj;
@@ -219,8 +219,8 @@ static int binder_parse(int fd, binder_uintptr_t ptr, binder_size_t size)break ;default :if (verbose) -printf ("Service Provider parsed unknown command: %d\n" , - cmd); +printf ("Service Provider parsed unknown command: %lu\n" , + (long unsigned )cmd);exit (81 ); } }
@@ -307,8 +307,8 @@ int main(int argc, char **argv) pid =getpid ();if (verbose) { -printf ("Service Provider PID: %d Process context:\n\t%s\n" , - pid, context); +printf ("Service Provider PID: %ld Process context:\n\t%s\n" , + (long )pid, context); }free (context);
@@ -383,8 +383,8 @@ int main(int argc, char **argv) }if (verbose) -printf ("Service Provider read_consumed: %lld\n" , - bwr.read_consumed); +printf ("Service Provider read_consumed: %llu\n" , + (long long unsigned )bwr.read_consumed); cmd =binder_parse (fd, (binder_uintptr_t )readbuf, bwr.read_consumed);
@@ -454,8 +454,8 @@ int main(int argc, char **argv)continue ;if (verbose) -printf ("Service Provider read_consumed: %lld\n" , - bwr.read_consumed); +printf ("Service Provider read_consumed: %llu\n" , + (long long unsigned )bwr.read_consumed); cmd =binder_parse (fd, (binder_uintptr_t )readbuf, bwr.read_consumed);
Signature · 1 line
2.54.0
Re: [PATCH testsuite 1/4] tests/binder: fix compiler warnings on ppc64le
Quoted 6 lines · Ondrej Mosnáček
Use the correct format specifiers and casts to make sure that the code compiles and works correctly on all architectures. This particularly fixes compiler warnings on ppc64le, which are now treated as errors.
Signed-off-by Ondrej Mosnáček <[email protected]>
Non-blocking nit that can be fixed in subsequent patch(es): client.c and service_provider.c still print obj->fd / obj.fd (__u32 via struct binder_fd_object) with %d; same class as the handle fields fixed here, might fold in for consistency.
Otherwise,
Ondrej Mosnáček
reviewerPATCH 2/4 tests/perf_event: fix compiler warnings on ppc64le
In reply to Ondrej MosnáčekUse the correct format specifiers and casts to make sure that the code compiles and works correctly on all architectures. This particularly fixes a compiler warning on ppc64le, which is now treated as an error.
--- tests/perf_event/perf_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/perf_event/perf_event.c +1 -1
@@ -161,7 +161,7 @@ int main(int argc, char **argv)if (verbose) { pe_page = base;printf ("perf mmap(2) return value: %lld\n" , - pe_page->offset); + (long long )pe_page->offset); }munmap (base, mmap_size);
Signature · 1 line
2.54.0
Re: [PATCH testsuite 2/4] tests/perf_event: fix compiler warnings on ppc64le
Quoted 6 lines · Ondrej Mosnáček
Use the correct format specifiers and casts to make sure that the code compiles and works correctly on all architectures. This particularly fixes a compiler warning on ppc64le, which is now treated as an error.
Signed-off-by Ondrej Mosnáček <[email protected]>
Ondrej Mosnáček
reviewerPATCH 3/4 tests/filesystem/statfs_test.c: fix a compiler warning on s390x
In reply to Ondrej MosnáčekUse the correct format specifiers and casts to make sure that the code compiles and works correctly on all architectures. This particularly fixes a compiler warning on s390x, which is now treated as an error.
--- tests/filesystem/statfs_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/filesystem/statfs_test.c +1 -1
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])if (verbose)printf ("statfs(2) returned magic filesystem: 0x%lx\n" , - statfs_t.f_type); + (long unsigned )statfs_t.f_type);return 0 ; }
Signature · 1 line
2.54.0
Re: [PATCH testsuite 3/4] tests/filesystem/statfs_test.c: fix a compiler warning on s390x
Quoted 6 lines · Ondrej Mosnáček
Use the correct format specifiers and casts to make sure that the code compiles and works correctly on all architectures. This particularly fixes a compiler warning on s390x, which is now treated as an error.
Signed-off-by Ondrej Mosnáček <[email protected]>
Ondrej Mosnáček
reviewerPATCH 4/4 tmt,ci: add a mutli-arch compile test
In reply to Ondrej MosnáčekTest that the testsuite builds on all architectures supported by Fedora in a mock chroot. The test runs on an x86_64 machine, with x86_64 build ran natively, while transparent QEMU emulation is used for the other arches (that is slow, but better than having no coverage).
--- .github/workflows/checks.yml | 13 +++++++++ tmt/README.md | 2 +- tmt/plans.fmf | 11 +++++++- tmt/tests.fmf | 54 ++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 2 deletions(-)
.github/workflows/checks.yml +13 -0
@@ -11,6 +11,19 @@ jobs: - uses: actions/checkout@v4 - run: sudo chown $(id -u):$(id -g) . - run: tools/check-syntax -f && git diff --exit-code + compile-test: + runs-on: ubuntu-latest + steps: + - name: Schedule compile-test on Testing Farm + uses: sclorg/testing-farm-as-github-action@main + with: + api_key: ${{ secrets.TESTING_FARM_API_TOKEN }} + arch: x86_64 + compose: Fedora-latest + tmt_plan_filter: tag:compile + tmt_hardware: '{ "cpu": { "cores": ">=16" } }' + # no need for the "guest setup" - it just takes a lot of time for no benefit + environment_settings: '{ "pipeline": { "skip_guest_setup": true } }' run: runs-on: ubuntu-latest strategy:
tmt/README.md +1 -1
@@ -4,7 +4,7 @@ This directory contains basic "test plans" for running the selinux-testsuite via ```bash tmt run [-e STS_ROOT_DOMAIN=...] [-e STS_KERNEL=...] \ - plans -f 'tag:-ci' --all provision -h ... + plans -f 'tag:-ci & tag:-compile' --all provision -h ... ``` See `tmt run provision --help` for information about possible provisioning methods (most useful are `local`, `connect`, or `virtual.testcloud`).
tmt/plans.fmf +10 -1
@@ -2,7 +2,7 @@ summary: Run the testsuite discover: how: fmf - filter: tag:-ci + filter: tag:-ci & tag:-compile execute: how: tmt /run-ci:
@@ -10,5 +10,14 @@ tag: [ci] discover: how: fmf + filter: tag:-compile + execute: + how: tmt +/compile-test: + summary: Test compilation on various architectures + tag: [compile] + discover: + how: fmf + filter: tag:compile execute: how: tmt
tmt/tests.fmf +54 -0
57 lines not on this page · raw message
Signature · 1 line
2.54.0
Re: [PATCH testsuite 4/4] tmt,ci: add a mutli-arch compile test
Quoted 7 lines · Ondrej Mosnáček
Test that the testsuite builds on all architectures supported by Fedora in a mock chroot. The test runs on an
x86_64machine, withx86_64build ran natively, while transparent QEMU emulation is used for the other arches (that is slow, but better than having no coverage).Signed-off-by Ondrej Mosnáček <[email protected]>
typo in the subject (mutli->multi) but otherwise:
Ondrej Mosnáček
reviewerQuoted 26 lines · Ondrej Mosnáček
This series fixes build warnings on some architectures that became fatal after -Werror was added to build flags. It also adds a simple compile test to the CI that runs
make allon all architectures supported by Fedora, so that they can be discovered earlier in the future.Ondrej Mosnáček (4):
tests/binder: fix compiler warnings on ppc64le tests/perf_event: fix compiler warnings on ppc64letests/filesystem/statfs_test.c: fix a compiler warning on s390x tmt,ci: add a mutli-arch compile test.github/workflows/checks.yml | 13 ++++++++ tests/binder/binder_common.c | 36 +++++++++++----------- tests/binder/check_binder.c | 8 ++--- tests/binder/check_binderfs.c | 10 +++--- tests/binder/client.c | 36 +++++++++++----------- tests/binder/manager.c | 37 +++++++++++----------- tests/binder/service_provider.c | 22 +++++++------- tests/filesystem/statfs_test.c | 2 +- tests/perf_event/perf_event.c | 2 +- tmt/README.md | 2 +- tmt/plans.fmf | 11 ++++++- tmt/tests.fmf | 54 +++++++++++++++++++++++++++++++++ 12 files changed, 155 insertions(+), 78 deletions(-)
Quoted 3 lines
--
2.54.0
Applied with Stephen's review comments incorporated. Thanks for the review!