From 999c7389964142454d131ec4aa56679ce08cacb3 Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Tue, 22 Oct 2019 13:57:28 -0400 Subject: [PATCH 1/2] ci: test arm builds, so they don't keep breaking --- .travis.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index e795469b8..7b95b04c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,25 @@ language: rust -rust: - - stable - - nightly-2019-10-17 - -sudo: required - services: - docker -os: - - linux - - osx +jobs: + include: + - os: linux + arch: amd64 + rust: stable + - os: linux + arch: amd64 + rust: nightly-2019-10-17 + env: RDKAFKA_RUN_TESTS=1 + - os: linux + arch: arm64 + rust: stable + - os: osx + rust: stable script: - - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_RUST_VERSION" == nightly* ]]; then ./test_suite.sh; else cargo build --verbose; fi + - if [[ "$RDKAFKA_RUN_TESTS" ]]; then ./test_suite.sh; else cargo build --verbose; fi notifications: webhooks: From c78a50ee39594cdf211669f2bf84400ae079c1a8 Mon Sep 17 00:00:00 2001 From: jerry73204 Date: Fri, 4 Oct 2019 21:46:05 +0800 Subject: [PATCH 2/2] Fix arm build again --- src/consumer/base_consumer.rs | 4 ++-- src/consumer/mod.rs | 2 +- src/util.rs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/consumer/base_consumer.rs b/src/consumer/base_consumer.rs index f009745d3..101ef2bdc 100644 --- a/src/consumer/base_consumer.rs +++ b/src/consumer/base_consumer.rs @@ -176,7 +176,7 @@ impl Consumer for BaseConsumer { } let ret_code = unsafe { rdsys::rd_kafka_subscribe(self.client.native_ptr(), tpl.ptr()) }; if ret_code.is_error() { - let error = unsafe { cstr_to_owned(rdsys::rd_kafka_err2str(ret_code) as *const i8) }; + let error = unsafe { cstr_to_owned(rdsys::rd_kafka_err2str(ret_code)) }; return Err(KafkaError::Subscription(error)); }; Ok(()) @@ -189,7 +189,7 @@ impl Consumer for BaseConsumer { fn assign(&self, assignment: &TopicPartitionList) -> KafkaResult<()> { let ret_code = unsafe { rdsys::rd_kafka_assign(self.client.native_ptr(), assignment.ptr()) }; if ret_code.is_error() { - let error = unsafe { cstr_to_owned(rdsys::rd_kafka_err2str(ret_code) as *const i8) }; + let error = unsafe { cstr_to_owned(rdsys::rd_kafka_err2str(ret_code)) }; return Err(KafkaError::Subscription(error)); }; Ok(()) diff --git a/src/consumer/mod.rs b/src/consumer/mod.rs index b3164e648..b9500778b 100644 --- a/src/consumer/mod.rs +++ b/src/consumer/mod.rs @@ -51,7 +51,7 @@ pub trait ConsumerContext: ClientContext { } RDKafkaRespErr::RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS => Rebalance::Revoke, _ => { - let error = unsafe { cstr_to_owned(rdsys::rd_kafka_err2str(err) as *const i8) }; + let error = unsafe { cstr_to_owned(rdsys::rd_kafka_err2str(err)) }; error!("Error rebalancing: {}", error); Rebalance::Error(error) } diff --git a/src/util.rs b/src/util.rs index a3eaffaa2..b28f77766 100644 --- a/src/util.rs +++ b/src/util.rs @@ -102,12 +102,12 @@ impl IntoOpaque for Box { // TODO: check if the implementation returns a copy of the data and update the documentation /// Converts a byte array representing a C string into a String. -pub unsafe fn bytes_cstr_to_owned(bytes_cstr: &[i8]) -> String { +pub unsafe fn bytes_cstr_to_owned(bytes_cstr: &[c_char]) -> String { CStr::from_ptr(bytes_cstr.as_ptr() as *const c_char).to_string_lossy().into_owned() } /// Converts a C string into a String. -pub unsafe fn cstr_to_owned(cstr: *const i8) -> String { +pub unsafe fn cstr_to_owned(cstr: *const c_char) -> String { CStr::from_ptr(cstr as *const c_char).to_string_lossy().into_owned() } @@ -122,7 +122,7 @@ impl ErrBuf { ErrBuf { buf: [0; ErrBuf::MAX_ERR_LEN] } } - pub fn as_mut_ptr(&mut self) -> *mut i8 { + pub fn as_mut_ptr(&mut self) -> *mut c_char { self.buf.as_mut_ptr() }