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

Socket test failing in Beats #73

Closed
namrata-ibm opened this issue May 31, 2017 · 14 comments
Closed

Socket test failing in Beats #73

namrata-ibm opened this issue May 31, 2017 · 14 comments

Comments

@namrata-ibm
Copy link

While building Beats on a Big Endian system, one of the socket related test fails which uses Go sigar code sys/linux/inetdiag.go. Will it be possible to add Big Endian support in Go sigar ?

@namrata-ibm
Copy link
Author

Any update on this?
@ruflin / @knz Could you please have a look?

@ruflin
Copy link

ruflin commented Jun 2, 2017

@andrewkroh is probably the better person here to give some feedback.

@andrewkroh
Copy link
Member

Which test is failing? Can you provide the output?

The endianness is hardcoded in a few places IRRC. The endianness could be extracted to a variable and populated based on the detected endianness of the machine.

@namrata-ibm
Copy link
Author

While executing go test -v github.com/elastic/beats/metricbeat/module/system/socket from metricbeat , the execution hangs at TestFetch:

=== RUN   TestHashSet
--- PASS: TestHashSet (0.00s)
=== RUN   TestListenerTable
--- PASS: TestListenerTable (0.00s)
=== RUN   TestData
--- SKIP: TestData (0.00s)
        data_generator.go:38: Skip data generation tests
=== RUN   TestFetch

If I modify the serialize and ParseInetDiagMsg functions from inetdiag.go file, to change the occurrences of binary.LittleEndian to binary.BigEndian, the test passes.

@namrata-ibm
Copy link
Author

@andrewkroh, could you please have a look at the above?

@andrewkroh
Copy link
Member

Oh, so it's a test in Metricbeat.

I think that package should have a variable like

var endianness binary.ByteOrder

and update all hard-coded places to use the variable.

Then have an init() function that detects the endian.

// NOT TESTED
func init() {
        var i int32 = 0x1
	v := (*[4]byte)(unsafe.Pointer(&i))
	if v[0] == 0 {
		endianness = binary.BigEndian
	} else {
		endianness = binary.LittleEndian
	}
}

WDYT?

@namrata-ibm
Copy link
Author

@andrewkroh, ya this looks good.

@namrata-ibm
Copy link
Author

Can this change be merged? @andrewkroh, the above patch works fine on little and big endian.

@Nayana-ibm
Copy link

@andrewkroh As you suggested in your comment, we have worked on adding big endian support for gosigar.
Raised PR #98 . Could you please review?

@Nayana-ibm
Copy link

As #100 is merged, Can you please update beats source code to have latest commit of gosigar? This will fix the issues with big endian.

@ruflin
Copy link

ruflin commented Mar 14, 2018

@andrewkroh Should we do a gosigar release?

@Nayana-ibm
Copy link

@andrewkroh @ruflin Can Beats use latest stable of gosigar ? This will fix the issues with big endian.

@andrewkroh
Copy link
Member

It looks like v0.9.0 is being used by Beats on master and 6.3 branches. See vendor.json. v0.9.0 includes the endian changes.

@Nayana-ibm
Copy link

Thanks. Will wait for 6.3 tag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants