I'm not sure why people think testing bombs = zomg NK nuclear war.
Being an unfavorable and diminutive leader doesn't make Kim Jong irrational. If he were a true lunatic, he'd have done something crazy years ago and been over with it. He would have unleashed that solar ion cannon on the Korean DMZ like in James Bond. But he hasn't. Playing against the UN's wishes doesn't make you crazy, though it certainly digs a deeper hole for yourself.
Right now, nuclear weapons only really fulfill two roles for North Korea, as I said. One is to ensure nobody conventionally invades them again. This strategy is pretty sound - I'll randomly cite Israel post-67' as an active example in how nuclear arms can secure relative peace to a state's mainland. Only thing is, other than possible paranoid delusions from the NK regime, you'd need a reason to necessitate the political cost of nukes vs. the final, though arguably negligible security boost from nukes.
Which leads to reason number two - they're looking to share / sell technology to allies. That's why I brought up Iran (again, known diplomatic ties and cooperative efforts in the nuclear program) as well as potentially any other buyer. If they were looking to use the weapons in a direct offensive role, they could sell them on the market. Problem is, nuclear weapons ain't exactly difficult to track and trace. Any attack would more than likely be inevitably traced back to Pongyang which would again result in death.
So you're really only looking at option one, with the real question being "were they simply that paranoid regarding the Bush administration's Axis of Evil rhetoric, or do they have a reason for added defense?"
They won't be firing them off at Japan or South Korea anytime soon, not without a dramatic systemic shift in their favor somehow.