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

FreeBSD: System.Drawing.Printing tests are failing #23786

Closed
wfurt opened this issue Oct 10, 2017 · 7 comments
Closed

FreeBSD: System.Drawing.Printing tests are failing #23786

wfurt opened this issue Oct 10, 2017 · 7 comments
Labels
area-System.Drawing bug help wanted [up-for-grabs] Good issue for external contributors os-freebsd FreeBSD OS
Milestone

Comments

@wfurt
Copy link
Member

wfurt commented Oct 10, 2017

=== TEST EXECUTION SUMMARY ===
System.Drawing.Common.Tests Total: 1731, Errors: 0, Failed: 31, Skipped: 1327, Time: 1.415s
~/git/corefx/bin/tests/System.Drawing.Common.Tests/netcoreapp-FreeBSD-Debug-x64

 ---- System.TypeInitializationException : The type initializer for 'System.Drawing.Printing.LibcupsNative' threw an exception.
  -------- System.DllNotFoundException : Unable to load DLL 'libdl': The specified module or one of its dependencies could not be found.
   (Exception from HRESULT: 0x8007007E)
  Stack Trace:
     /home/furt/git/wfurt2-corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingServices.Unix.cs(88,0): at System.Drawing.Printing.PrintingServices.get_DefaultPrinter()
     /home/furt/git/wfurt2-corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.Unix.cs(70,0): at System.Drawing.Printing.PrinterSettings..ctor()
     /home/furt/git/wfurt2-corefx/src/System.Drawing.Common/tests/Printing/PrinterSettingsTests.cs(224,0): at System.Drawing.Printing.Tests.PrinterSettingsTests.MaximumPage_SetValue_ReturnsExpected(Int32 maximumPage)
     ----- Inner Stack Trace -----
     /home/furt/git/wfurt2-corefx/src/System.Drawing.Common/src/System/Drawing/Printing/LibcupsNative.cs(44,0): at System.Drawing.Printing.LibcupsNative.cupsGetDefault()
     /home/furt/git/wfurt2-corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingServices.Unix.cs(107,0): at System.Drawing.Printing.PrintingServices.CheckCupsInstalled()
     /home/furt/git/wfurt2-corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingServices.Unix.cs(64,0): at System.Drawing.Printing.PrintingServices..cctor()
     ----- Inner Stack Trace -----
        at Interop.Libdl.dlopen(String fileName, Int32 flag)
     /home/furt/git/wfurt2-corefx/src/System.Drawing.Common/src/System/Drawing/Printing/LibcupsNative.cs(17,0): at System.Drawing.Printing.LibcupsNative.LoadLibcups()
     /home/furt/git/wfurt2-corefx/src/System.Drawing.Common/src/System/Drawing/Printing/LibcupsNative.cs(12,0): at System.Drawing.Printing.LibcupsNative..cctor()

This is because FreeBSD has dlopen in libc instead of libdl.
This may be simple as updating src/Common/src/Interop/Unix/Interop.Libraries.cs
libcups.so seems to exit but no testing has been done.

This is part of https://github.com/dotnet/corefx/issues/1626

@wfurt
Copy link
Member Author

wfurt commented Oct 10, 2017

fixing dlopen makes the test not fail.
=== TEST EXECUTION SUMMARY ===
System.Drawing.Common.Tests Total: 1731, Errors: 0, Failed: 0, Skipped: 1327, Time: 0.641s
~/git/corefx/bin/tests/System.Drawing.Common.Tests/netcoreapp-FreeBSD-Debug-x64
Finished running tests. End time=05:16:26. Return value was 0

Most of the skipped tests comes from libgdiplus. That is separate issues.
Also note that the test has embedded dlopn() code in it self. (Helpers.cs)

@safern
Copy link
Member

safern commented Feb 6, 2018

Similar to: https://github.com/dotnet/corefx/issues/25102 which should be taken care of soon once we get the desired API added into the product. https://github.com/dotnet/corefx/issues/17135

@am11
Copy link
Member

am11 commented Dec 16, 2018

Some library loading APIs have been recently checked in System.Runtime.InteropServices.netcoreapp.cs. Is it too early to update LibcupsNative.cs#L18-L22 to resolve this issue; something like:

-            IntPtr lib = Interop.Libdl.dlopen("libcups.so", Interop.Libdl.RTLD_NOW);
+            IntPtr lib = Marshal.LoadLibrary("libcups.so");
            if (lib == IntPtr.Zero)
            {
-                lib = Interop.Libdl.dlopen("libcups.so.2", Interop.Libdl.RTLD_NOW);
+                lib = Marshal.LoadLibrary("libcups.so.2");
            }

@wfurt
Copy link
Member Author

wfurt commented Dec 17, 2018

I'll take a look. Many other parts of netcore would put the actual library name to Interop/Library.cs instead of embedding names inside of the specific code.

@am11
Copy link
Member

am11 commented Apr 16, 2019

@wfurt, this one was updated in Feb dotnet/corefx#35548. I think we just need to build and test it (once FreeBSD builds are restored). :)

@wfurt
Copy link
Member Author

wfurt commented Apr 16, 2019

probably. I think this was mostly about loading, not even test execution.

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the Future milestone Jan 31, 2020
@maryamariyan maryamariyan added the untriaged New issue has not been triaged by the area owner label Feb 23, 2020
@tannergooding tannergooding removed the untriaged New issue has not been triaged by the area owner label Jul 8, 2020
@wfurt
Copy link
Member Author

wfurt commented Feb 16, 2022

seems no longer applicable.

@wfurt wfurt closed this as completed Feb 16, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Mar 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Drawing bug help wanted [up-for-grabs] Good issue for external contributors os-freebsd FreeBSD OS
Projects
None yet
Development

No branches or pull requests

6 participants