The Foundation Cracks: A Comprehensive Study on Bugs and Testing Practices in LLM Libraries