usbredir: add test

This commit is contained in:
Jeffrey Wildman 2019-01-06 15:49:30 -05:00
parent e5229d7a06
commit 16fbc92218

View file

@ -3,6 +3,7 @@ class Usbredir < Formula
homepage "https://www.spice-space.org" homepage "https://www.spice-space.org"
url "https://www.spice-space.org/download/usbredir/usbredir-0.8.0.tar.bz2" url "https://www.spice-space.org/download/usbredir/usbredir-0.8.0.tar.bz2"
sha256 "87bc9c5a81c982517a1bec70dc8d22e15ae197847643d58f20c0ced3c38c5e00" sha256 "87bc9c5a81c982517a1bec70dc8d22e15ae197847643d58f20c0ced3c38c5e00"
revision 1
depends_on "libtool" => :build depends_on "libtool" => :build
depends_on "pkg-config" => :build depends_on "pkg-config" => :build
@ -10,7 +11,7 @@ class Usbredir < Formula
depends_on "libusb" depends_on "libusb"
def install def install
#https://stackoverflow.com/questions/15860127/how-to-configure-tcp-keepalive-under-mac-os-x # https://stackoverflow.com/questions/15860127/how-to-configure-tcp-keepalive-under-mac-os-x
inreplace "usbredirserver/usbredirserver.c" do |s| inreplace "usbredirserver/usbredirserver.c" do |s|
s.gsub! "SOL_TCP", "IPPROTO_TCP" s.gsub! "SOL_TCP", "IPPROTO_TCP"
s.gsub! "TCP_KEEPIDLE", "TCP_KEEPALIVE" s.gsub! "TCP_KEEPIDLE", "TCP_KEEPALIVE"
@ -20,4 +21,18 @@ class Usbredir < Formula
"--prefix=#{prefix}" "--prefix=#{prefix}"
system "make", "install" system "make", "install"
end end
test do
(testpath/"test.cpp").write <<~EOS
#include <usbredirparser.h>
int main() {
return usbredirparser_create() ? 0 : 1;
}
EOS
system ENV.cc, "test.cpp",
"-L#{lib}",
"-lusbredirparser",
"-o", "test"
system "./test"
end
end end